Relrin / kurier

A cross-platform GUI client for testing AMQP-based APIs
BSD 3-Clause "New" or "Revised" License
41 stars 3 forks source link

Can't build on current MacOS arm systems #20

Closed BreninSul closed 1 year ago

BreninSul commented 1 year ago
(venv) breninsul@MacBook-Air-BreninSul kurier % pyinstaller --clean --workpath=build/temp --distpath=build/dist --onefile --nowindowed --noconsole --name=Kurier ./kurier/main.py
100 INFO: PyInstaller: 3.4
100 INFO: Python: 3.10.7
106 INFO: Platform: macOS-13.0.1-arm64-arm-64bit
107 INFO: wrote /Users/breninsul/kurier/Kurier.spec
108 INFO: UPX is not available.
108 INFO: Removing temporary files and cleaning cache in /Users/breninsul/Library/Application Support/pyinstaller
109 INFO: Extending PYTHONPATH with paths
['/Users/breninsul/kurier', '/Users/breninsul/kurier']
109 INFO: checking Analysis
109 INFO: Building Analysis because Analysis-00.toc is non existent
109 INFO: Initializing module dependency graph...
110 INFO: Initializing module graph hooks...
111 INFO: Analyzing base_library.zip ...
arch: posix_spawnp: /Users/breninsul/kurier/venv/bin/python3.10: Bad CPU type in executable
arch: posix_spawnp: /Users/breninsul/kurier/venv/bin/python3.10: Bad CPU type in executable
1553 INFO: Processing pre-find module path hook   distutils
Traceback (most recent call last):
  File "/Users/breninsul/kurier/venv/bin/pyinstaller", line 8, in <module>
    sys.exit(run())
  File "/Users/breninsul/kurier/venv/lib/python3.10/site-packages/PyInstaller/__main__.py", line 111, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "/Users/breninsul/kurier/venv/lib/python3.10/site-packages/PyInstaller/__main__.py", line 63, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "/Users/breninsul/kurier/venv/lib/python3.10/site-packages/PyInstaller/building/build_main.py", line 838, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "/Users/breninsul/kurier/venv/lib/python3.10/site-packages/PyInstaller/building/build_main.py", line 784, in build
    exec(text, spec_namespace)
  File "<string>", line 6, in <module>
  File "/Users/breninsul/kurier/venv/lib/python3.10/site-packages/PyInstaller/building/build_main.py", line 241, in __init__
    self.__postinit__()
  File "/Users/breninsul/kurier/venv/lib/python3.10/site-packages/PyInstaller/building/datastruct.py", line 158, in __postinit__
    self.assemble()
  File "/Users/breninsul/kurier/venv/lib/python3.10/site-packages/PyInstaller/building/build_main.py", line 346, in assemble
    self.graph = initialize_modgraph(
  File "/Users/breninsul/kurier/venv/lib/python3.10/site-packages/PyInstaller/depend/analysis.py", line 613, in initialize_modgraph
    graph.import_hook(m)
  File "/Users/breninsul/kurier/venv/lib/python3.10/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 1420, in import_hook
    target_package, target_module_partname = self._find_head_package(
  File "/Users/breninsul/kurier/venv/lib/python3.10/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 1599, in _find_head_package
    raise ImportError("No module named " + target_package_name)
ImportError: No module named _bootlocale

with --exclude-module _bootlocale flag:

(venv) breninsul@MacBook-Air-BreninSul kurier % pyinstaller --clean --workpath=build/temp --distpath=build/dist --onefile --nowindowed --noconsole --name=Kurier ./kurier/main.py --exclude-module _bootlocale
99 INFO: PyInstaller: 3.4
99 INFO: Python: 3.10.7
105 INFO: Platform: macOS-13.0.1-arm64-arm-64bit
105 INFO: wrote /Users/breninsul/kurier/Kurier.spec
107 INFO: UPX is not available.
107 INFO: Removing temporary files and cleaning cache in /Users/breninsul/Library/Application Support/pyinstaller
108 INFO: Extending PYTHONPATH with paths
['/Users/breninsul/kurier', '/Users/breninsul/kurier']
108 INFO: checking Analysis
108 INFO: Building Analysis because Analysis-00.toc is non existent
108 INFO: Initializing module dependency graph...
109 INFO: Initializing module graph hooks...
110 INFO: Analyzing base_library.zip ...
arch: posix_spawnp: /Users/breninsul/kurier/venv/bin/python3.10: Bad CPU type in executable
arch: posix_spawnp: /Users/breninsul/kurier/venv/bin/python3.10: Bad CPU type in executable
1616 INFO: Processing pre-find module path hook   distutils
1928 INFO: running Analysis Analysis-00.toc
1932 INFO: Caching module hooks...
1934 INFO: Analyzing /Users/breninsul/kurier/kurier/main.py
2123 INFO: Loading module hooks...
2123 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
2124 INFO: Loading module hook "hook-lib2to3.py"...
2125 INFO: Loading module hook "hook-encodings.py"...
arch: posix_spawnp: /Users/breninsul/kurier/venv/bin/python3.10: Bad CPU type in executable
2130 INFO: Loading module hook "hook-pubsub.core.py"...
arch: posix_spawnp: /Users/breninsul/kurier/venv/bin/python3.10: Bad CPU type in executable
2134 INFO: Loading module hook "hook-sysconfig.py"...
2148 INFO: Loading module hook "hook-xml.py"...
2165 INFO: Loading module hook "hook-pydoc.py"...
2165 INFO: Loading module hook "hook-distutils.py"...
2172 INFO: Looking for ctypes DLLs
2181 INFO: Analyzing run-time hooks ...
2182 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
2185 INFO: Looking for dynamic libraries
2220 INFO: Looking for eggs
2220 INFO: Using Python library /opt/homebrew/Cellar/python@3.10/3.10.7/Frameworks/Python.framework/Versions/3.10/Python
2221 INFO: Warnings written to build/temp/Kurier/warn-Kurier.txt
2232 INFO: Graph cross-reference written to build/temp/Kurier/xref-Kurier.html
2237 INFO: checking PYZ
2237 INFO: Building PYZ because PYZ-00.toc is non existent
2237 INFO: Building PYZ (ZlibArchive) build/temp/Kurier/PYZ-00.pyz
Traceback (most recent call last):
  File "/Users/breninsul/kurier/venv/bin/pyinstaller", line 8, in <module>
    sys.exit(run())
  File "/Users/breninsul/kurier/venv/lib/python3.10/site-packages/PyInstaller/__main__.py", line 111, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "/Users/breninsul/kurier/venv/lib/python3.10/site-packages/PyInstaller/__main__.py", line 63, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "/Users/breninsul/kurier/venv/lib/python3.10/site-packages/PyInstaller/building/build_main.py", line 838, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "/Users/breninsul/kurier/venv/lib/python3.10/site-packages/PyInstaller/building/build_main.py", line 784, in build
    exec(text, spec_namespace)
  File "<string>", line 18, in <module>
  File "/Users/breninsul/kurier/venv/lib/python3.10/site-packages/PyInstaller/building/api.py", line 98, in __init__
    self.__postinit__()
  File "/Users/breninsul/kurier/venv/lib/python3.10/site-packages/PyInstaller/building/datastruct.py", line 158, in __postinit__
    self.assemble()
  File "/Users/breninsul/kurier/venv/lib/python3.10/site-packages/PyInstaller/building/api.py", line 128, in assemble
    self.code_dict = {
  File "/Users/breninsul/kurier/venv/lib/python3.10/site-packages/PyInstaller/building/api.py", line 129, in <dictcomp>
    key: strip_paths_in_code(code)
  File "/Users/breninsul/kurier/venv/lib/python3.10/site-packages/PyInstaller/building/utils.py", line 654, in strip_paths_in_code
    consts = tuple(
  File "/Users/breninsul/kurier/venv/lib/python3.10/site-packages/PyInstaller/building/utils.py", line 655, in <genexpr>
    strip_paths_in_code(const_co, new_filename)
  File "/Users/breninsul/kurier/venv/lib/python3.10/site-packages/PyInstaller/building/utils.py", line 662, in strip_paths_in_code
    return code_func(co.co_argcount, co.co_kwonlyargcount, co.co_nlocals, co.co_stacksize,
TypeError: 'bytes' object cannot be interpreted as an integer
Relrin commented 1 year ago

I think this is the issue related to the compatibility between the PyInstaller and the Python 3.10. Have you tried to install and to use the latest version (e.g. 5.7.0)?

patrosAT commented 1 year ago

I had the same problem, it was related to wxPython. I fixed it by (I) using Python 3.9 and by (II) installing the packages individually (instead of using the requirement files).

Relrin commented 1 year ago

Could you provide a list of installed packages? I'm mostly interested in those that different from the original installation / requirements files

patrosAT commented 1 year ago

There is no difference, except I did not provide version numbers: PyInstaller wxPython Pypubsub pika Faker flake8 ipython pytest pytest-cov pudb

Relrin commented 1 year ago

I pushed the updates with latest dependency updates in the master branch. Please, let me know, that the build works good to you. I tested the build on my local machine on Windows and finishes with no issues. However, I have no notebook with MacOS to test this out.

BreninSul commented 1 year ago

Now it works! Thanks!