ronaldoussoren / py2app

py2app is a Python setuptools command which will allow you to make standalone Mac OS X application bundles and plugins from Python scripts.
Other
340 stars 36 forks source link

build x86_64 on Mac M1 error to run on Intel Mac #488

Closed sasukebinbin closed 1 year ago

sasukebinbin commented 1 year ago

I'm using Mac M1 with py2app 0.28.5 and Python 3.10. Trying to build with python3 setup.py py2app It can run on other M1. But not Intel. Banned sign cannot open.

Trying to build with python3 setup.py py2app --arch universal2 M1 with no issue as before. Intel can open now, but shows error Open console or Terminate

Trying to debug on Intel Mac ./CaseSearch.app/Contents/MacOS/CaseSearch Got below output dlopen(/Users/rex/Desktop/CaseSearch.app/Contents/Frameworks/Python.framework/Versions/3.10/Python, 0x0001): tried: '/Users/rex/Desktop/CaseSearch.app/Contents/Frameworks/Python.framework/Versions/3.10/Python' (mach-o file, but is an incompatible architecture (have (arm64), need (x86_64h))), '/Library/Frameworks/Python.framework/Versions/3.10/Python' (no such file), '/System/Library/Frameworks/Python.framework/Versions/3.10/Python' (no such file)%

Got another Intel Mac shows almost the same output but the newer Intel Mac need (x86_64) without h.

Trying to build with python3 setup.py py2app --arch x86_64h shows error: [Errno 2] No such file or directory: b'/opt/homebrew/lib/python3.10/site-packages/py2app/apptemplate/prebuilt/main-x86_64h'

Trying to build with python3 setup.py py2app --arch x86_64 No issue. But Intel mac shows the same error as above.

Apperaciated anyone can help!

cikichen commented 1 year ago

+1

ronaldoussoren commented 1 year ago

Given the error message the python installation you are using only supports arm64 ("Apple Silicon") and not x86_64 ("Intel"). Py2app cannot do anything about this, although a future version will at least warn when you try to build a "Universal 2" application that contains single architecture binaries.

I don't know how to install "Universal 2" versions using homebrew, but the macPS installer on the python.org does support both architectures. If this works for you depends on which libraries and other tools you use as this will be a completely separate installation and not all useful packages have universal2 wheels on PyPI.

JYPochez commented 8 months ago

how do you deal with this error ? just install python again ?