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
342 stars 36 forks source link

pyside6 doesn't work (python 3.10, universal2) #442

Open ronaldoussoren opened 2 years ago

ronaldoussoren commented 2 years ago

While working on something else I noticed that a pyside6 test app doesn't launch properly due to not finding library dependencies.

This is with the in development version, I haven't checked if the current release has this problem as well.

alfwatt commented 2 years ago

Same problem on an M1 Mac

$ pip show py2app
Name: py2app
Version: 0.28
Summary: Create standalone Mac OS X applications with Python
Home-page: http://github.com/ronaldoussoren/py2app
Author: Ronald Oussoren
Author-email: ronaldoussoren@mac.com
License: MIT or PSF License
Location: /opt/homebrew/lib/python3.9/site-packages
Requires: altgraph, macholib, modulegraph
Required-by: 
schleising commented 2 years ago

I think I'm seeing the same issue, it seems to be that the application is looking for libshuboken6.abi3.6.3.dylib in the PySide6 folder instead of the shiboken6 folder,

Traceback (most recent call last):
  File "/Users/steve/Documents/Coding/Python/PyQtImageViewer/dist/PyQtImageViewer.app/Contents/Resources/__boot__.py", line 522, in <module>
    _run()
  File "/Users/steve/Documents/Coding/Python/PyQtImageViewer/dist/PyQtImageViewer.app/Contents/Resources/__boot__.py", line 394, in _run
    exec(compile(source, path, "exec"), globals(), globals())
  File "/Users/steve/Documents/Coding/Python/PyQtImageViewer/dist/PyQtImageViewer.app/Contents/Resources/main.py", line 3, in <module>
    from PySide6.QtWidgets import QApplication
ImportError: dlopen(/Users/steve/Documents/Coding/Python/PyQtImageViewer/dist/PyQtImageViewer.app/Contents/Resources/lib/python3.10/PySide6/QtWidgets.abi3.so, 0x0002): Library not loaded: @rpath/libshiboken6.abi3.6.3.dylib
  Referenced from: /Users/steve/Documents/Coding/Python/PyQtImageViewer/dist/PyQtImageViewer.app/Contents/Resources/lib/python3.10/PySide6/QtWidgets.abi3.so
  Reason: tried: '/Users/steve/Documents/Coding/Python/PyQtImageViewer/dist/PyQtImageViewer.app/Contents/Resources/lib/python3.10/PySide6/libshiboken6.abi3.6.3.dylib' (no such file), '/Users/steve/Documents/Coding/Python/PyQtImageViewer/dist/PyQtImageViewer.app/Contents/Resources/lib/python3.10/PySide6/Qt/lib/libshiboken6.abi3.6.3.dylib' (no such file), '/Users/steve/Documents/Coding/Python/PyQtImageViewer/dist/PyQtImageViewer.app/Contents/Resources/lib/python3.10/PySide6/libshiboken6.abi3.6.3.dylib' (no such file), '/Users/steve/Documents/Coding/Python/PyQtImageViewer/dist/PyQtImageViewer.app/Contents/Resources/lib/python3.10/PySide6/Qt/lib/libshiboken6.abi3.6.3.dylib' (no such file), '/opt/homebrew/lib/libshiboken6.abi3.6.3.dylib' (no such file), '/usr/local/lib/libshiboken6.abi3.6.3.dylib' (no such file), '/usr/lib/libshiboken6.abi3.6.3.dylib' (no such file)
2022-06-23 21:52:27.636 PyQtImageViewer[15017:6195039] Launch error
2022-06-23 21:52:27.636 PyQtImageViewer[15017:6195039] Launch error
See the py2app website for debugging launch issues

Copying libshiboken6.abi3.6.3.dylib to the PySide6 folder within the .app structure works around this issue.

I should have added originally that this is on a M1 MacBook Pro running macOS Monterey v12.4 and Homebrew Python 3.10

random-developer commented 1 year ago

I copied the dylib from .virtualenvs/python-3.10.4-pyside6/lib/python3.10/site-packages/shiboken6/libshiboken6.abi3.6.3.dylib to dist/MyApp.app/Contents/Resources/lib/python3.10/PySide6/Qt/lib/libshiboken6.abi3.6.3.dylib, and now instead of failing to load I just get a segfault / crash.

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   Python                                 0x10764da00 PyObject_SetAttrString + 24
1   libshiboken6.abi3.6.3.dylib            0x107f8072c init_enum + 100
2   libshiboken6.abi3.6.3.dylib            0x107f8072c init_enum + 100
3   libshiboken6.abi3.6.3.dylib            0x107f8f6fc InitSignatureStrings + 24

My py2app is 0.28.4.

joshburnett commented 1 year ago

I'm also seeing this issue on a small sample app. I did notice that the shiboken libraries are being (properly, I assume?) copied to dist/statusbar_test.app/Contents/Resources/lib/python3.11/shiboken6/.

Similar to @random-developer, I also get a segfault if I copy libshiboken6.abi3.6.4 to the app's PySide6 folder.

I'm running py2app 0.28.5 on an Intel Mac, Python 3.11. Happy to provide any other details as needed.

elias-jhsph commented 1 year ago

I am also seeing this issue on 3.10 python on an intel mac same as @joshburnett and @random-developer and copying causes the segfault as well

cikichen commented 1 year ago

'/usr/local/lib/libshiboken6.abi3.6.5.dylib' (no such file) python 3.8 mac m1 0.28.5

receyuki commented 1 year ago

python 3.10 mac intel 0.28.5 segment fault