Python Forum
[PYQT5 // PY2APP] -- Incompatibility issue
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PYQT5 // PY2APP] -- Incompatibility issue
#1
Hi again,

I realised that in my last post I perhaps was not clear enough about my question.

I am attempting to create a standalone application firstly for macOS and later Windows. Using this video for instructions I have successfully created the application. However when I attempt to run the application using the executable found within the package contents I get this error returned:

Traceback (most recent call last): File "/Users/tomeady/Desktop/dist/Main.app/Contents/Resources/__boot__.py", line 98, in <module> _run() File "/Users/tomeady/Desktop/dist/Main.app/Contents/Resources/__boot__.py", line 82, in _run exec(compile(source, path, 'exec'), globals(), globals()) File "/Users/tomeady/Desktop/dist/Main.app/Contents/Resources/Main.py", line 2, in <module> from PyQt5 import QtWidgets, QtGui, QtCoreImportError: dlopen(/Users/tomeady/Desktop/dist/Main.app/Contents/Resources/lib/python3.6/PyQt5/QtWidgets.so, 2): Library not loaded: @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets

Referenced from: /Users/tomeady/Desktop/dist/Main.app/Contents/Resources/lib/python3.6/PyQt5/QtWidgets.so
Reason: Incompatible library version: QtWidgets.so requires version 5.8.0 or later, but QtWidgets provides version 5.3.0

I have checked and made sure that all of my modules are up to date and correctly imported. When I build the app using the -A flag (non-stadalone) it runs fine, as it should.

Could someone please break this down and potentially offer a fix for me as I have been stuck for quite a while, if you need any other information please let me know.

Thanks, Tom.
Reply
#2
Try installing the latest PyQt5 version i.e 5.9 right now. Link
Reply
#3
I have it installed as 5.9 on my python 3.6.2, I used pip3 to install
Reply
#4
I have no experience with this and I use Linux but it may be that you have an older version in your PATH which is found before the one you have installed. If you have then remove it.
Reply
#5
It could be py2app failing to resolve dependencies. Try PyInstaller if still, you get similar error then the problem is with your pyqt5 installation you have to uninstall it (delete residual packages if any) and reinstall it
Reply
#6
Ok so, there are no other versions of pyqt apart from pyqt4, which would not be causing the issue as I am importing pyqt5 only.

Pyinstaller doesn't currently support python 3.6.1.

Has anyone tried using pyqt5, python3.6 and py2app, with any success?
Reply
#7
(Aug-09-2017, 11:04 AM)Tome Wrote: Pyinstaller doesn't currently support python 3.6.1.
Work if useĀ develop branch.
pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
Reply
#8
Okay managed to get this all working and it definitely seems as though it was an issue with py2app. Thanks snippsat for the advice!

HOWEVER, I've run into a new problem, my app now runs perfectly fine from the unix executable found in the package contents but when I double click or use terminal to run the 'main.app' in the dist folder it fails to launch.

I found a similar thread here but there was no conclusion, any thoughts on why this might be?

edit: for clarifiation, I built it successfully with pyinstaller.

re: Last post

System log reads:
"[date] [time] [address] com.apple.xpc.launchd[1] (org.pythonmac.unspecified.Main.15428[57525]): Service exited with abnormal code: 255"

[some details omitted]
Reply
#9
(Aug-09-2017, 10:40 AM)hbknjr Wrote: It could be py2app failing to resolve dependencies. Try PyInstaller if still, you get similar error then the problem is with your pyqt5 installation you have to uninstall it (delete residual packages if any) and reinstall it

It took me over 10 hours to finally got my qt working. Tackled all kinds of problems and this is the last one of them. Now it works like a charm. Thanks hbknjr, you're my hero. Just registered this to thank you. Thank you!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Huge code problems (buttons(PyQt5),PyQt5 Threads, Windows etc) ZenWoR 0 2,785 Apr-06-2019, 11:15 PM
Last Post: ZenWoR
  PYQT py2app Compiling Tome 0 3,016 Jul-27-2017, 11:27 AM
Last Post: Tome

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020