Open redo7370 opened 9 months ago
For the record, I now also tried to install the packages in a python venv and the same problems occured. Also, installing packages for arm64 did not work by declaring it in the command line with „arch -arm64 …“.
It is indeed an import error due to arm64 not being included in the packages installed.
Traceback (most recent call last):
File "/Users/username/Desktop/qrm_v1.0.app/Contents/Resources/__boot__.py", line 170, in <module>
_run()
File "/Users/username/Desktop/qrm_v1.0.app/Contents/Resources/__boot__.py", line 84, in _run
exec(compile(source, path, "exec"), globals(), globals())
File "/Users/username/Desktop/qrm_v1.0.app/Contents/Resources/qrm_v1.0.py", line 5, in <module>
from PIL import Image
File "PIL/Image.pyc", line 84, in <module>
File "PIL/_imaging.pyc", line 14, in <module>
File "PIL/_imaging.pyc", line 10, in __load
File "imp.pyc", line 343, in load_dynamic
ImportError: dlopen(/Users/username/Desktop/qrm_v1.0.app/Contents/Resources/lib/python3.11/lib-dynload/PIL/_imaging.so, 0x0002): tried: '/Users/username/Desktop/qrm_v1.0.app/Contents/Resources/lib/python3.11/lib-dynload/PIL/_imaging.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/username/Desktop/qrm_v1.0.app/Contents/Resources/lib/python3.11/lib-dynload/PIL/_imaging.so' (no such file), '/Users/username/Desktop/qrm_v1.0.app/Contents/Resources/lib/python3.11/lib-dynload/PIL/_imaging.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))
2024-02-13 13:19:32.840 qrm_v1.0[82739:1319035] Launch error
2024-02-13 13:19:32.840 qrm_v1.0[82739:1319035] Launch error
See the py2app website for debugging launch issues
So yeah, I guess I‘m close to figuring out how to make it distributable to arm64, but I have not yet found a way to install a arm64 package on an x86_64 device even with a VEnv.
After some digging I tried again.
$ python3 -m venv env
$ . env/bin/activate
$ pip install py2app
$ python3 -m pip install --only-binary=:all: --platform macosx_11_0_arm64 Pillow
$ python3 -m pip install --only-binary=:all: --platform macosx_11_0_arm64 customtkinter
$ python3 -m pip install --only-binary=:all: --platform macosx_11_0_arm64 qrcode
$ py2applet --make-setup file.py
$ python setup.py py2app --arch arm64
I don't know how to include the .whl into the process and haven't found something yet that provides help with correctly including them, so the app can run on arm64 as well.
I've tried to create simple gui apps with py2app. Generally everything works fine on my machine which is an Intel Mac. Using the standard libraries with tkinter, filedialoge and collections everything works fine when distributed too. Yet when adding external libraries such as customtkinter, qrdcode, PIL and segno, the apps crash. I've searched for solutions for a long time and none of the flags in the documentation where of any help. I left my setup.py untouched and only added packages through the command line in case py2app didnt catch them. Still it didn't work. I noticed that some imports failed in the building process and think the problem may lay within those.
Until today I have only distributed to another Silicon Mac (defining the right building arch and all that yada yada). And as said before. Standard libraries work fine, those installed through pip do not.
I'm not sure if there's a solution to this, but it's been 2 and a half months now that I've been looking for a solution and this is pretty much the last clue I have as to what might have gone wrong.