Closed garrettmflynn closed 1 year ago
looks like we just need to list tornado
as a Python dependency
Ran again after installing tornado
, but it still breaks at that last ValueError
Update: Found this issue already open which may have something useful to say. Though it might just be faster to build on non-Mac machines.
@CodyCBakerPhD Works on Windows and the latest SODA application is also fine despite no obvious inconsistencies.
Could you try on your Mac (even if it's M1) just to see if you get the same error? Want to make sure it isn't just an issue with my system.
On my M1 I get
For npm run python-onefile-build
:
and with npm run build-mac
Windows build worked fine for me though
For the record, I get the same ValueError as in the OP on my Mac M1. Will investigate.
I got past the error by installing some packages from conda-forge instead of building them locally which resulted in architecture mismatches. I can build the app but when I run it, I get:
❯ /Users/rly/Documents/NWB/nwb-guide/pyflaskdist/app ; exit;
Traceback (most recent call last):
File "app.py", line 8, in <module>
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "PyInstaller/loader/pyimod02_importers.py", line 385, in exec_module
File "namespaces/__init__.py", line 1, in <module>
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "PyInstaller/loader/pyimod02_importers.py", line 385, in exec_module
File "namespaces/configureNamespaces.py", line 1, in <module>
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "PyInstaller/loader/pyimod02_importers.py", line 385, in exec_module
File "flask_restx/__init__.py", line 1, in <module>
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "PyInstaller/loader/pyimod02_importers.py", line 385, in exec_module
File "flask_restx/reqparse.py", line 15, in <module>
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "PyInstaller/loader/pyimod02_importers.py", line 385, in exec_module
File "flask_restx/model.py", line 13, in <module>
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "PyInstaller/loader/pyimod02_importers.py", line 385, in exec_module
File "jsonschema/__init__.py", line 17, in <module>
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "PyInstaller/loader/pyimod02_importers.py", line 385, in exec_module
File "jsonschema/validators.py", line 19, in <module>
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "PyInstaller/loader/pyimod02_importers.py", line 385, in exec_module
File "jsonschema_specifications/__init__.py", line 11, in <module>
File "referencing/_core.py", line 297, in __rmatmul__
File "jsonschema_specifications/_core.py", line 27, in _schemas
File "pathlib.py", line 1017, in iterdir
FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/cp/nh4x2lls1qq03jh58crvh8t00000gp/T/_MEILQEzPe/jsonschema_specifications/schemas'
[649] Failed to execute script 'app' due to unhandled exception!
The latest versions of jsonschema and jsonschema_specifications are installed. I think the path to the .json files in jsonschema_specifications/schemas/
needs to be included. @CodyCBakerPhD @garrettmflynn have you seen this issue in the other OS builds?
Regarding the sonpy error:
sonpy is a package to read CED / Spike2 files in Python. It is closed-source and officially distributed in compiled form by CED. It is released on PyPI, but is restricted to Python 3.9 or earlier (to be specific, the latest version is restricted to Python 3.9 only, but older versions work on Python 3.7 and 3.8). Neuroconv accounts for this -- if the user is running Python 3.10+ and tries to convert Spike2 data, they will get an error. sonpy also does not run on Apple Silicon. Related discussion: https://github.com/NeurodataWithoutBorders/nwb-guide/pull/244
On Python 3.9 on macOS x86, it runs fine. On this system, for some reason, the .../linux/sonpy.so
file within the sonpy package cannot be read by pyinstaller, resulting in the error in the first post. My guess is that this file was built for linux, but we are building for macs (it lives in .../linux/sonpy.so
next to a separate .../darwin/sonpy.so
for macs). Pyinstaller tries to read all *.so files and trips up because of that. #353 supports that theory -- deleting that file on mac builds allows the build to complete.
We should reach out to CED and see if they can release wheels for Python 3.10 and Python 3.11 so that we are not locked to Python 3.9, and also wheels for Python 3.9-3.11 for arm64.
For macos arm64 builds, I need to pip uninstall sonpy
to build the distributable locally. Otherwise I get the error:
PyInstaller.utils.osx.IncompatibleBinaryArchError: /Users/rly/mambaforge/envs/nwb-guide/lib/python3.9/site-packages/sonpy/darwin/sonpy.so is incompatible with target arch arm64 (has arch: x86_64)!
Attempting to run
python-onefile-build
fails to output anything on Mac.Below is the output to the terminal until an exit code is thrown: