Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSX Install/Running #4

Open
er1c opened this issue Jul 31, 2021 · 5 comments
Open

OSX Install/Running #4

er1c opened this issue Jul 31, 2021 · 5 comments

Comments

@er1c
Copy link

er1c commented Jul 31, 2021

I think some of the packages need to be pinned to specific versions - the error below has some errors - maybe some of the packages (e.g. pyopengl need to be pinned to specific versions?) Do you know which versions you have installed?

Setup Instructions

pip install -U pip setuptools
pip install -U virtualenv

pip install virtualenv
git clone [email protected]:nightgryphon/gryphon-scan.git
cd gryphon-scan
virtualenv venv
virtualenv venv --system-site-packages
source venv/bin/activate


pip install -U pyserial pyopengl pyopengl-accelerate numpy scipy matplotlib==1.4.0 py2app==0.7.2

pip install -U pyobjc-core==2.5.1 pyobjc-framework-cocoa==2.5.1 pyobjc-framework-quartz==2.5.1 pyobjc-framework-qtkit==2.5.1

./package.sh darwin

Package Output

./package.sh darwin
/Users/eric/Work/gryphon-scan/venv/lib/python2.7/site-packages/setuptools/dist.py:485: UserWarning: The version specified ('') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
  "details." % self.metadata.version
running py2app
creating /Users/eric/Work/gryphon-scan/dar_dist/build
creating /Users/eric/Work/gryphon-scan/dar_dist/build/python2.7-standalone
creating /Users/eric/Work/gryphon-scan/dar_dist/build/python2.7-standalone/app
creating /Users/eric/Work/gryphon-scan/dar_dist/build/python2.7-standalone/app/collect
creating /Users/eric/Work/gryphon-scan/dar_dist/build/python2.7-standalone/app/temp
creating /Users/eric/Work/gryphon-scan/dar_dist/dist
creating dar_dist/build/python2.7-standalone/app/lib-dynload
creating dar_dist/build/python2.7-standalone/app/Frameworks
*** using recipe: virtualenv ***
*** using recipe: sip ***
*** using recipe: matplotlib ***
*** using recipe: pydoc ***
*** using recipe: docutils ***
*** using recipe: scipy ***
*** using recipe: pyopengl ***
Traceback (most recent call last):
  File "setup_mac.py", line 39, in <module>
    setup_requires=['py2app'])
  File "/Users/eric/Work/gryphon-scan/venv/lib/python2.7/site-packages/setuptools/__init__.py", line 162, in setup
    return distutils.core.setup(**attrs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/Users/eric/Work/gryphon-scan/venv/lib/python2.7/site-packages/py2app/build_app.py", line 520, in run
    self._run()
  File "/Users/eric/Work/gryphon-scan/venv/lib/python2.7/site-packages/py2app/build_app.py", line 708, in _run
    self.run_normal()
  File "/Users/eric/Work/gryphon-scan/venv/lib/python2.7/site-packages/py2app/build_app.py", line 783, in run_normal
    self.process_recipes(mf, filters, flatpackages, loader_files)
  File "/Users/eric/Work/gryphon-scan/venv/lib/python2.7/site-packages/py2app/build_app.py", line 677, in process_recipes
    find_needed_modules(mf, packages=rval['packages'])
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/modulegraph/find_modules.py", line 222, in find_needed_modules
    m = mf.import_hook(package, None, ["*"])
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/modulegraph/modulegraph.py", line 685, in import_hook
    m = self.load_tail(q, tail)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/modulegraph/modulegraph.py", line 780, in load_tail
    result = self.import_module(head, mname, result)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/modulegraph/modulegraph.py", line 847, in import_module
    m = self.load_module(fqname, fp, pathname, stuff)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/modulegraph/modulegraph.py", line 871, in load_module
    m = self.load_package(fqname, pathname, packagepath)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/modulegraph/modulegraph.py", line 1094, in load_package
    self.load_module(fqname, fp, buf, stuff)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/modulegraph/modulegraph.py", line 909, in load_module
    self.scan_code(co, m)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/modulegraph/modulegraph.py", line 1015, in scan_code
    imported_module = self._safe_import_hook(name, m, fromlist, level)[0]
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/modulegraph/modulegraph.py", line 917, in _safe_import_hook
    mods = self.import_hook(name, caller, level=level)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/modulegraph/modulegraph.py", line 685, in import_hook
    m = self.load_tail(q, tail)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/modulegraph/modulegraph.py", line 780, in load_tail
    result = self.import_module(head, mname, result)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/modulegraph/modulegraph.py", line 847, in import_module
    m = self.load_module(fqname, fp, pathname, stuff)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/modulegraph/modulegraph.py", line 909, in load_module
    self.scan_code(co, m)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/modulegraph/modulegraph.py", line 1062, in scan_code
    self.scan_code(c, m)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/modulegraph/modulegraph.py", line 1062, in scan_code
    self.scan_code(c, m)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/modulegraph/modulegraph.py", line 1015, in scan_code
    imported_module = self._safe_import_hook(name, m, fromlist, level)[0]
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/modulegraph/modulegraph.py", line 949, in _safe_import_hook
    sm = self.import_hook(name, caller, [sub], level=level)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/modulegraph/modulegraph.py", line 688, in import_hook
    for s in self.ensure_fromlist(m, fromlist):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/modulegraph/modulegraph.py", line 797, in ensure_fromlist
    submod = self.import_module(sub, fullname, m)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/modulegraph/modulegraph.py", line 847, in import_module
    m = self.load_module(fqname, fp, pathname, stuff)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/modulegraph/modulegraph.py", line 883, in load_module
    co = compile(contents, pathname, 'exec', 0, True)
  File "/Library/Python/2.7/site-packages/OpenGL/EGL/debug.py", line 39
    print("P3", file=f)
                    ^
SyntaxError: invalid syntax
chmod: cannot access 'dar_dist/dist/Horus.app/Contents/Resources/res/tools/darwin/avrdude': No such file or directory
chmod: cannot access 'dar_dist/dist/Horus.app/Contents/Resources/res/tools/darwin/avrdude_bin': No such file or directory
chmod: cannot access 'dar_dist/dist/Horus.app/Contents/Resources/res/tools/darwin/lib/': No such file or directory
pkg/darwin/create-dmg/create-dmg: line 129: cd: dar_dist/dist/Horus.app: No such file or directory
Creating disk image...
........................................................................................................................................................................................................
created: /Users/eric/Work/gryphon-scan/dar_dist/rw.Horus_0.2rc1.dmg
Mounting disk image...
Unmounting disk image...
"disk2" ejected.
Mount directory: /Volumes/Horus Installer
Device name:     /dev/disk2
Copying background file...
making link to Applications dir
/Volumes/Horus Installer
Copying volume icon file 'res/horus.icns'...
mktemp: too few X's in template ‘createdmg’

Running directly

./horus
dyld: warning, LC_RPATH @executable_path/../Frameworks in /Users/eric/Library/Python/2.7/lib/python/site-packages/cv2/.dylibs/QtWidgets being ignored in restricted program because of @executable_path (Codesign main executable with Library Validation to allow @ paths)
dyld: warning, LC_RPATH @executable_path/../Frameworks in /Users/eric/Library/Python/2.7/lib/python/site-packages/cv2/.dylibs/QtGui being ignored in restricted program because of @executable_path (Codesign main executable with Library Validation to allow @ paths)
dyld: warning, LC_RPATH @executable_path/../Frameworks in /Users/eric/Library/Python/2.7/lib/python/site-packages/cv2/.dylibs/QtCore being ignored in restricted program because of @executable_path (Codesign main executable with Library Validation to allow @ paths)
dyld: warning, LC_RPATH @executable_path/../Frameworks in /Users/eric/Library/Python/2.7/lib/python/site-packages/cv2/.dylibs/QtTest being ignored in restricted program because of @executable_path (Codesign main executable with Library Validation to allow @ paths)
dyld: warning, LC_RPATH @executable_path/../Frameworks in /Users/eric/Library/Python/2.7/lib/python/site-packages/cv2/.dylibs/QtConcurrent being ignored in restricted program because of @executable_path (Codesign main executable with Library Validation to allow @ paths)
No handlers could be found for logger "horus.util.profile"
Traceback (most recent call last):
  File "./horus", line 52, in <module>
    main()
  File "./horus", line 48, in main
    from horus.gui import app
  File "./src/horus/gui/app.py", line 12, in <module>
    from horus.gui.main import MainWindow
  File "./src/horus/gui/main.py", line 17, in <module>
    from horus.gui.engine import driver, image_capture, ciclop_scan, scanner_autocheck, \
  File "./src/horus/gui/engine.py", line 9, in <module>
    from horus.engine.driver.driver import driver
  File "./src/horus/engine/driver/driver.py", line 12, in <module>
    from horus.engine.driver.camera_usb import Camera_usb
  File "./src/horus/engine/driver/camera_usb.py", line 29, in <module>
    from uvc.mac import *
  File "./src/horus/engine/driver/uvc/mac/__init__.py", line 26, in <module>
    from raw import *
  File "./src/horus/engine/driver/uvc/mac/raw.py", line 107, in <module>
    __uvcc_dll = CDLL(dll_path)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 366, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(res/tools/darwin/uvcc.so, 6): no suitable image found.  Did find:
	file system relative paths not allowed in hardened programs
@er1c
Copy link
Author

er1c commented Jul 31, 2021

Updated Setup:

pip install -U pip setuptools
pip install -U virtualenv

pip install virtualenv
git clone [email protected]:nightgryphon/gryphon-scan.git
cd gryphon-scan
virtualenv venv
source venv/bin/activate


pip install -U pyserial pyopengl pyopengl-accelerate numpy scipy matplotlib==1.4.0 py2app==0.7.2 setuptools==3.4

Output

...
scan/dar_dist/dist/Horus.app/Contents/Resources/mpl-data/stylelib/dark_background.mplstyle
Traceback (most recent call last):
  File "setup_mac.py", line 39, in <module>
    setup_requires=['py2app'])
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/Users/eric/Work/gryphon-scan/venv/lib/python2.7/site-packages/py2app/build_app.py", line 520, in run
    self._run()
  File "/Users/eric/Work/gryphon-scan/venv/lib/python2.7/site-packages/py2app/build_app.py", line 708, in _run
    self.run_normal()
  File "/Users/eric/Work/gryphon-scan/venv/lib/python2.7/site-packages/py2app/build_app.py", line 798, in run_normal
    self.create_binaries(py_files, pkgdirs, extensions, loader_files)
  File "/Users/eric/Work/gryphon-scan/venv/lib/python2.7/site-packages/py2app/build_app.py", line 921, in create_binaries
    dpath = os.path.join(prefix, 'Resources', 'Python.app', 'Contents', 'MacOS')
UnboundLocalError: local variable 'prefix' referenced before assignment
Creating disk image...
......................................................................................................................................................................................................
created: /Users/eric/Work/gryphon-scan/dar_dist/rw.Horus_0.2rc1.dmg
Mounting disk image...
Unmounting disk image...
"disk2" ejected.
Mount directory: /Volumes/Horus Installer
Device name:     /dev/disk2
Copying background file...
making link to Applications dir
/Volumes/Horus Installer
Copying volume icon file 'res/horus.icns'...
mktemp: too few X's in template ‘createdmg’

image

@er1c
Copy link
Author

er1c commented Jul 31, 2021

Looks like I had to upgrade python 2.7: python 2.7.18: https://www.python.org/downloads/release/python-2718/

/Volumes/Horus Installer
Copying volume icon file 'res/horus.icns'...
mktemp: too few X's in template ‘createdmg’
    ~/Work/gryphon-scan    develop !1 ?1                                                                                                                                       41s   10:13:55 AM  
❯ ack createdmg
pkg/darwin/create-dmg/create-dmg
183:APPLESCRIPT=$(mktemp -t createdmg)
    ~/Work/gryphon-scan    develop !1 ?1                                                                                                                                               10:14:13 AM  
❯ mktemp -t createdmg
mktemp: too few X's in template ‘createdmg’
    ~/Work/gryphon-scan    develop !1 ?1                                                                                                                                               10:14:27 AM  
❯ mktemp -t createdmgXXXXX
/var/folders/xd/h9x37m7s5fx_14m7ltfj2vjc0000gn/T/createdmgYgiiB
    ~/Work/gryphon-scan    develop !1 ?1                                                                                                                                               10:14:30 AM  
❯

@er1c
Copy link
Author

er1c commented Jul 31, 2021

On latest OSX there is one OpenGL issue:

  File "/Applications/Horus.app/Contents/Resources/lib/python2.7/OpenGL/platform/darwin.py", line 41, in GL
    raise ImportError("Unable to load OpenGL library", *err.args)
ImportError: ('Unable to load OpenGL library', 'dlopen(OpenGL, 10): image not found', 'OpenGL', None)

This can be fixed by editing: /Applications/Horus.app/Contents/Resources/lib/python2.7/OpenGL/platform/ctypesloader.py

Replace: fullName = util.find_library( name ) with: fullName = '/System/Library/Frameworks/OpenGL.framework/OpenGL'

It will load the app, but it doesn't appear to have access to the camera, so looks like there is still some other issue.

@er1c
Copy link
Author

er1c commented Jul 31, 2021

❯ ./Horus
/Applications/Horus.app/Contents/Resources/lib/python27.zip
/Applications/Horus.app/Contents/Resources/lib/python2.7
/Applications/Horus.app/Contents/Resources/lib/python2.7/plat-darwin
/Applications/Horus.app/Contents/Resources/lib/python2.7/plat-mac
/Applications/Horus.app/Contents/Resources/lib/python2.7/plat-mac/lib-scriptpackages
/Applications/Horus.app/Contents/Resources/lib/python2.7/lib-tk
/Applications/Horus.app/Contents/Resources/lib/python2.7/lib-old
/Applications/Horus.app/Contents/Resources/lib/python2.7/lib-dynload
dlopen(/Applications/Horus.app/Contents/Resources/lib/python2.7/lib-dynload/wx/_core.so, 2): Library not loaded: @loader_path/libwx_osx_cocoau_core-3.1.5.0.0.dylib
  Referenced from: /Applications/Horus.app/Contents/Resources/lib/python2.7/lib-dynload/wx/_core.so
  Reason: image not found
Traceback (most recent call last):
  File "/Applications/Horus.app/Contents/Resources/__boot__.py", line 47, in <module>
    _run()
  File "/Applications/Horus.app/Contents/Resources/__boot__.py", line 38, in _run
    exec(compile(source, path, 'exec'), globals(), globals())
  File "/Applications/Horus.app/Contents/Resources/horus", line 23, in <module>
    exit(1)
NameError: name 'exit' is not defined
2021-07-31 10:18:34.414 Horus[54857:2550638] Horus Error

HRMFP

@nightgryphon
Copy link
Owner

nightgryphon commented Aug 2, 2021

regarding missing "uvcc.so" error take a look at
src/horus/engine/driver/uvc/mac/
build it separately with "make" before running the app. You has to get uvcc.so file if build succeeds.
this library overcomes missing parameters within MAC camera API

also do not use package.sh as it is outdated. just run the app directly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants