NeurodataWithoutBorders / nwb-guide

NWB GUIDE is a desktop app that provides a no-code user interface for converting neurophysiology data to NWB.
https://nwb-guide.readthedocs.io/
MIT License
22 stars 3 forks source link

[Mac]: Python server unable to be built with Pyinstaller #89

Closed garrettmflynn closed 1 year ago

garrettmflynn commented 1 year ago

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:

1495 INFO: PyInstaller: 4.7
1495 INFO: Python: 3.9.7 (conda)
1528 INFO: Platform: macOS-10.16-x86_64-i386-64bit
1529 INFO: wrote /Users/garrettflynn/Documents/Github/nwb-guide/app.spec
1561 INFO: UPX is not available.
1562 INFO: Removing temporary files and cleaning cache in /Users/garrettflynn/Library/Application Support/pyinstaller
1570 INFO: Extending PYTHONPATH with paths
['/Users/garrettflynn/Documents/Github/nwb-guide/pyflask']
2821 INFO: checking Analysis
2821 INFO: Building Analysis because Analysis-00.toc is non existent
2821 INFO: Initializing module dependency graph...
2825 INFO: Caching module graph hooks...
2834 WARNING: Several hooks defined for module 'numpy'. Please take care they do not conflict.
2846 INFO: Analyzing base_library.zip ...
5322 INFO: Processing pre-find module path hook distutils from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks/pre_find_module_path/hook-distutils.py'.
5455 INFO: distutils: retargeting to non-venv dir '/opt/anaconda3/envs/env-electron-python/lib/python3.9'
8663 INFO: Caching module dependency graph...
8815 INFO: running Analysis Analysis-00.toc
8827 INFO: Analyzing /Users/garrettflynn/Documents/Github/nwb-guide/pyflask/app.py
13879 INFO: Processing pre-safe import module hook six.moves from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks/pre_safe_import_module/hook-six.moves.py'.
14659 INFO: Processing pre-safe import module hook urllib3.packages.six.moves from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks/pre_safe_import_module/hook-urllib3.packages.six.moves.py'.
19687 INFO: Processing pre-find module path hook site from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks/pre_find_module_path/hook-site.py'.
19688 INFO: site: retargeting to fake-dir '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/fake-modules'
43074 INFO: Processing pre-safe import module hook win32com from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/_pyinstaller_hooks_contrib/hooks/pre_safe_import_module/hook-win32com.py'.
56327 INFO: Processing module hooks...
56327 INFO: Loading module hook 'hook-py.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
56376 INFO: Loading module hook 'hook-numcodecs.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
56378 INFO: Loading module hook 'hook-jinja2.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
56380 INFO: Loading module hook 'hook-boto3.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
57163 INFO: Loading module hook 'hook-appdirs.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
57182 INFO: Loading module hook 'hook-h5py.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
57185 INFO: Loading module hook 'hook-jsonschema.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
57203 INFO: Loading module hook 'hook-pydantic.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
58210 INFO: Loading module hook 'hook-certifi.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
58214 INFO: Loading module hook 'hook-pytest.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
58417 INFO: Loading module hook 'hook-openpyxl.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
58486 INFO: Loading module hook 'hook-lxml.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
59053 INFO: Loading module hook 'hook-lxml.etree.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
59055 INFO: Loading module hook 'hook-flask_restx.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
59068 INFO: Loading module hook 'hook-botocore.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
59895 INFO: Loading module hook 'hook-Cryptodome.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
59908 INFO: Loading module hook 'hook-numpy.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/numpy/_pyinstaller'...
59959 WARNING: Conda distribution 'numpy', dependency of 'numpy', was not found. If you installed this distribution with pip then you may ignore this warning.
59993 INFO: Import to be excluded not found: 'f2py'
60027 INFO: Loading module hook 'hook-scipy.linalg.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
60031 INFO: Loading module hook 'hook-sqlite3.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
60103 INFO: Loading module hook 'hook-pkg_resources.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
61250 WARNING: Hidden import "pkg_resources.py2_warn" not found!
61250 WARNING: Hidden import "pkg_resources.markers" not found!
61261 INFO: Loading module hook 'hook-pandas.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
63876 INFO: Loading module hook 'hook-scipy.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
63879 INFO: Loading module hook 'hook-xml.etree.cElementTree.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
63881 INFO: Loading module hook 'hook-scipy.special._ufuncs.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
63883 INFO: Loading module hook 'hook-pytz.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
63992 INFO: Loading module hook 'hook-lib2to3.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
64040 INFO: Loading module hook 'hook-_tkinter.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
64312 INFO: checking Tree
64313 INFO: Building Tree because Tree-00.toc is non existent
64313 INFO: Building Tree Tree-00.toc
64344 INFO: checking Tree
64344 INFO: Building Tree because Tree-01.toc is non existent
64344 INFO: Building Tree Tree-01.toc
64428 INFO: checking Tree
64429 INFO: Building Tree because Tree-02.toc is non existent
64429 INFO: Building Tree Tree-02.toc
64431 INFO: Loading module hook 'hook-scipy.spatial.transform.rotation.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
64493 INFO: Loading module hook 'hook-encodings.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
64577 INFO: Loading module hook 'hook-PIL.ImageFilter.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
64595 INFO: Loading module hook 'hook-distutils.util.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
64603 INFO: Loading module hook 'hook-keyring.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
64846 INFO: Loading module hook 'hook-pandas.io.formats.style.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
64853 INFO: Loading module hook 'hook-pandas.plotting.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
65025 INFO: Loading module hook 'hook-scipy.sparse.csgraph.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
65029 INFO: Loading module hook 'hook-PIL.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
65063 INFO: Loading module hook 'hook-setuptools.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
66618 INFO: Loading module hook 'hook-importlib_resources.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
66628 WARNING: Hidden import "importlib_resources.trees" not found!
66630 INFO: Loading module hook 'hook-zope.interface.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
66652 INFO: Loading module hook 'hook-gevent.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
Traceback (most recent call last):
  File "<string>", line 21, in walk_packages
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/gevent/testing/__init__.py", line 169, in <module>
    from unittest import mock
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/unittest/mock.py", line 26, in <module>
    import asyncio
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/asyncio/__init__.py", line 8, in <module>
    from .base_events import *
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/asyncio/base_events.py", line 18, in <module>
    import concurrent.futures
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/concurrent/futures/__init__.py", line 8, in <module>
    from concurrent.futures._base import (FIRST_COMPLETED,
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/concurrent/futures/_base.py", line 357
    raise type(self._exception), self._exception, self._traceback
                               ^
SyntaxError: invalid syntax
collect_submodules: failed to import 'gevent.testing'!
67680 INFO: Determining a mapping of distributions to packages...
82072 WARNING: Unable to find package for requirement zope.event from package gevent.
82072 WARNING: Unable to find package for requirement zope.interface from package gevent.
82072 INFO: Packages required by gevent:
['setuptools', 'greenlet']
83386 INFO: Loading module hook 'hook-matplotlib.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
83855 INFO: Loading module hook 'hook-xml.dom.domreg.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
83856 INFO: Loading module hook 'hook-PIL.Image.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
84216 INFO: Loading module hook 'hook-scipy.special._ellip_harm_2.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
84217 INFO: Loading module hook 'hook-scipy.io.matlab.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
84218 INFO: Loading module hook 'hook-packaging.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
84219 INFO: Loading module hook 'hook-pickle.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
84240 INFO: Loading module hook 'hook-matplotlib.backends.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
84952 INFO:   Matplotlib backend "GTK3Agg": ignored
    The GTK3 backends require PyGObject
85227 INFO:   Matplotlib backend "GTK3Cairo": ignored
    cairo backend requires that pycairo>=1.14.0 or cairocffi is installed
85627 INFO:   Matplotlib backend "GTK4Agg": ignored
    The GTK4 backends require PyGObject
85946 INFO:   Matplotlib backend "GTK4Cairo": ignored
    cairo backend requires that pycairo>=1.14.0 or cairocffi is installed
86702 INFO:   Matplotlib backend "MacOSX": added
86997 INFO:   Matplotlib backend "nbAgg": ignored
    No module named 'ipykernel'
87283 INFO:   Matplotlib backend "QtAgg": ignored
    Failed to import any of the following Qt binding modules: PyQt6, PySide6, PyQt5, PySide2
87563 INFO:   Matplotlib backend "QtCairo": ignored
    cairo backend requires that pycairo>=1.14.0 or cairocffi is installed
87835 INFO:   Matplotlib backend "Qt5Agg": ignored
    Failed to import any of the following Qt binding modules: PyQt6, PySide6, PyQt5, PySide2
88116 INFO:   Matplotlib backend "Qt5Cairo": ignored
    cairo backend requires that pycairo>=1.14.0 or cairocffi is installed
88761 INFO:   Matplotlib backend "TkAgg": added
89192 INFO:   Matplotlib backend "TkCairo": ignored
    cairo backend requires that pycairo>=1.14.0 or cairocffi is installed
89478 INFO:   Matplotlib backend "WebAgg": ignored
    Traceback (most recent call last):
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/matplotlib/backends/backend_webagg.py", line 27, in <module>
    import tornado
ModuleNotFoundError: No module named 'tornado'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<string>", line 12, in <module>
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/matplotlib/backends/backend_webagg.py", line 29, in <module>
    raise RuntimeError("The WebAgg backend requires Tornado.") from err
RuntimeError: The WebAgg backend requires Tornado.
89860 INFO:   Matplotlib backend "WX": ignored
    No module named 'wx'
90134 INFO:   Matplotlib backend "WXAgg": ignored
    No module named 'wx'
90405 INFO:   Matplotlib backend "WXCairo": ignored
    No module named 'wx'
90823 INFO:   Matplotlib backend "agg": added
91089 INFO:   Matplotlib backend "cairo": ignored
    cairo backend requires that pycairo>=1.14.0 or cairocffi is installed
91942 INFO:   Matplotlib backend "pdf": added
92615 INFO:   Matplotlib backend "pgf": added
93695 INFO:   Matplotlib backend "ps": added
94141 INFO:   Matplotlib backend "svg": added
94783 INFO:   Matplotlib backend "template": added
98282 INFO: Loading module hook 'hook-importlib_metadata.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
98284 INFO: Loading module hook 'hook-heapq.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
98302 INFO: Loading module hook 'hook-scipy.stats._stats.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
98304 INFO: Loading module hook 'hook-difflib.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
98322 INFO: Loading module hook 'hook-multiprocessing.util.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
98347 INFO: Loading module hook 'hook-sysconfig.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
98359 INFO: Loading module hook 'hook-xml.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
98361 INFO: Loading module hook 'hook-distutils.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
98364 INFO: Loading module hook 'hook-numpy._pytesttester.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
98377 INFO: Loading module hook 'hook-lxml.objectify.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
98382 INFO: Loading module hook 'hook-lxml.isoschematron.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
98391 INFO: Loading module hook 'hook-PIL.SpiderImagePlugin.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
98704 INFO: Loading module hook 'hook-setuptools.msvc.py' from '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks'...
99001 INFO: Looking for ctypes DLLs
99055 WARNING: Library user32 required via ctypes not found
99114 WARNING: Library msvcrt required via ctypes not found
99269 INFO: Analyzing run-time hooks ...
99299 INFO: Including run-time hook '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks/rthooks/pyi_rth_pkgutil.py'
99302 INFO: Including run-time hook '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks/rthooks/pyi_rth_multiprocessing.py'
99305 INFO: Including run-time hook '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks/rthooks/pyi_rth_inspect.py'
99307 INFO: Including run-time hook '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks/rthooks/pyi_rth__tkinter.py'
99309 INFO: Including run-time hook '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks/rthooks/pyi_rth_pkgres.py'
99315 INFO: Including run-time hook '/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/hooks/rthooks/pyi_rth_mplconfig.py'
99400 INFO: Looking for dynamic libraries
Traceback (most recent call last):
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/__main__.py", line 134, in <module>
    run()
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/__main__.py", line 124, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/__main__.py", line 58, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/building/build_main.py", line 782, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/building/build_main.py", line 714, in build
    exec(code, spec_namespace)
  File "/Users/garrettflynn/Documents/Github/nwb-guide/app.spec", line 7, in <module>
    a = Analysis(['pyflask/app.py'],
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/building/build_main.py", line 277, in __init__
    self.__postinit__()
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/building/datastruct.py", line 155, in __postinit__
    self.assemble()
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/building/build_main.py", line 494, in assemble
    self.binaries.extend(bindepend.Dependencies(self.binaries, redirects=self.binding_redirects))
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/depend/bindepend.py", line 210, in Dependencies
    for lib, npth in selectImports(pth, xtrapath):
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/depend/bindepend.py", line 462, in selectImports
    dlls = getImports(pth)
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/depend/bindepend.py", line 703, in getImports
    return _getImports_macholib(pth)
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/depend/bindepend.py", line 603, in _getImports_macholib
    m = MachO(pth)
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/macholib/MachO.py", line 122, in __init__
    self.load(fp)
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/macholib/MachO.py", line 137, in load
    self.load_header(fh, 0, size)
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/macholib/MachO.py", line 171, in load_header
    raise ValueError("Unknown Mach-O header: 0x%08x in %r" % (header, fh))
ValueError: Unknown Mach-O header: 0x7f454c46 in <_io.BufferedReader name='/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/sonpy/linux/sonpy.so'>
bendichter commented 1 year ago

looks like we just need to list tornado as a Python dependency

garrettmflynn commented 1 year ago

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.

garrettmflynn commented 1 year ago

@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.

CodyCBakerPhD commented 1 year ago

On my M1 I get

For npm run python-onefile-build:

``` 35759 WARNING: lipo command (['lipo', '-thin', 'arm64', '/Users/codybaker/Library/Application Support/pyinstaller/bincache00_py39_64bit/arm64/adhoc/no-entitlements/Cryptodome/PublicKey/_x25519.abi3.so', '-output', '/Users/codybaker/Library/Application Support/pyinstaller/bincache00_py39_64bit/arm64/adhoc/no-entitlements/Cryptodome/PublicKey/_x25519.abi3.so']) failed with error code 1! stdout: '' stderr: 'xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun\n' Traceback (most recent call last): File "/Users/codybaker/miniconda3/envs/env-electron-python/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/Users/codybaker/miniconda3/envs/env-electron-python/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/Users/codybaker/miniconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/__main__.py", line 134, in run() File "/Users/codybaker/miniconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/__main__.py", line 124, in run run_build(pyi_config, spec_file, **vars(args)) File "/Users/codybaker/miniconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/__main__.py", line 58, in run_build PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs) File "/Users/codybaker/miniconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/building/build_main.py", line 782, in main build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build')) File "/Users/codybaker/miniconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/building/build_main.py", line 714, in build exec(code, spec_namespace) File "/Users/codybaker/nwb-guide/app.spec", line 23, in exe = EXE(pyz, File "/Users/codybaker/miniconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/building/api.py", line 489, in __init__ self.pkg = PKG( File "/Users/codybaker/miniconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/building/api.py", line 204, in __init__ self.__postinit__() File "/Users/codybaker/miniconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/building/datastruct.py", line 155, in __postinit__ self.assemble() File "/Users/codybaker/miniconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/building/api.py", line 267, in assemble fnm = checkCache( File "/Users/codybaker/miniconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/building/utils.py", line 360, in checkCache osxutils.binary_to_target_arch(cachedfile, target_arch, display_name=fnm) File "/Users/codybaker/miniconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/utils/osx.py", line 300, in binary_to_target_arch convert_binary_to_thin_arch(filename, target_arch) File "/Users/codybaker/miniconda3/envs/env-electron-python/lib/python3.9/site-packages/PyInstaller/utils/osx.py", line 281, in convert_binary_to_thin_arch raise SystemError("lipo failure!") SystemError: lipo failure! ```

and with npm run build-mac

``` Done notarizing com.catalystneuro.nwbguide • building target=DMG arch=arm64 file=dist/NeuroConv-0.0.1-arm64.dmg • building target=macOS zip arch=arm64 file=dist/NeuroConv-0.0.1-arm64-mac.zip • building embedded block map file=dist/NeuroConv-0.0.1-arm64-mac.zip ⨯ Exit code: ENOENT. spawn /usr/bin/python ENOENT stackTrace= Error: Exit code: ENOENT. spawn /usr/bin/python ENOENT at /Users/codybaker/GitHub/nwb-guide/node_modules/builder-util/src/util.ts:129:16 at exithandler (node:child_process:406:5) at ChildProcess.errorhandler (node:child_process:418:5) at ChildProcess.emit (node:events:526:28) at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12) at onErrorNT (node:internal/child_process:478:16) at processTicksAndRejections (node:internal/process/task_queues:83:21) ```
CodyCBakerPhD commented 1 year ago

Windows build worked fine for me though

rly commented 1 year ago

For the record, I get the same ValueError as in the OP on my Mac M1. Will investigate.

rly commented 1 year ago

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?

rly commented 1 year ago

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)!