I am trying to compile my Python 3.9 script with PyInstaller on my MAC OS Catalina: MAC OS CATALINA 10.15.6 Python 3.9 Pyinstaller 4.2
My script has a GUI made of PyQt5. If I do a “pip freeze” I can see this:
PyQt5==5.15.4
PyQt5-Qt5==5.15.2
PyQt5-sip==12.8.1
PyQt6==6.0.3
PyQt6-sip==13.0.1
When I do “brew list” I get this:
assimp
glib
libpng
pcre2
readline
zstd
dbus
icu4c
libproxy
pkg-config
sip
double-conversion
jasper
libtiff
pyinstaller
sqlite
freetype
jpeg
mpdecimal
pyqt
tcl-tk
gdbm
libb2
openssl@1.1
python@3.9
webp
gettext
libffi
pcre
qt
xz
As soon as this line below is executed:
app = QtWidgets.QApplication(sys.argv)
I get this error message:
objc[32852]: Class QMacAutoReleasePoolTracker is implemented in both /usr/local/lib/python3.9/site-packages/PyQt5/Qt5/lib/QtCore.framework/Versions/5/QtCore (0x1221c0198) and /Users/alisa/Dropbox/cff/Python/PhoneBotV3/dist/PhoneBot.app/Contents/MacOS/QtCore (0x1312c7198). One of the two will be used. Which one is undefined.
objc[32852]: Class QT_ROOT_LEVEL_POOL__THESE_OBJECTS_WILL_BE_RELEASED_WHEN_QAPP_GOES_OUT_OF_SCOPE is implemented in both /usr/local/lib/python3.9/site-packages/PyQt5/Qt5/lib/QtCore.framework/Versions/5/QtCore (0x1221c0210) and /Users/alisa/Dropbox/cff/Python/PhoneBotV3/dist/PhoneBot.app/Contents/MacOS/QtCore (0x1312c7210). One of the two will be used. Which one is undefined.
objc[32852]: Class KeyValueObserver is implemented in both /usr/local/lib/python3.9/site-packages/PyQt5/Qt5/lib/QtCore.framework/Versions/5/QtCore (0x1221c0238) and /Users/alisa/Dropbox/cff/Python/PhoneBotV3/dist/PhoneBot.app/Contents/MacOS/QtCore (0x1312c7238). One of the two will be used. Which one is undefined.
objc[32852]: Class RunLoopModeTracker is implemented in both /usr/local/lib/python3.9/site-packages/PyQt5/Qt5/lib/QtCore.framework/Versions/5/QtCore (0x1221c0288) and /Users/alisa/Dropbox/cff/Python/PhoneBotV3/dist/PhoneBot.app/Contents/MacOS/QtCore (0x1312c7288). One of the two will be used. Which one is undefined.
objc[32852]: Class QCocoaPageLayoutDelegate is implemented in both /usr/local/lib/python3.9/site-packages/PyQt5/Qt5/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport (0x12f315540) and /Users/alisa/Dropbox/cff/Python/PhoneBotV3/dist/PhoneBot.app/Contents/MacOS/QtPrintSupport (0x130066540). One of the two will be used. Which one is undefined.
objc[32852]: Class QCocoaPrintPanelDelegate is implemented in both /usr/local/lib/python3.9/site-packages/PyQt5/Qt5/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport (0x12f3155b8) and /Users/alisa/Dropbox/cff/Python/PhoneBotV3/dist/PhoneBot.app/Contents/MacOS/QtPrintSupport (0x1300665b8). One of the two will be used. Which one is undefined.
QObject::moveToThread: Current thread (0x7fec075fd3a0) is not the object's thread (0x7fec07e67800).
Cannot move to target thread (0x7fec075fd3a0)
You might be loading two sets of Qt binaries into the same process. Check that all plugins are compiled against the right Qt binaries. Export DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded.
qt.qpa.plugin: Could not load the Qt platform plugin "cocoa" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: cocoa, minimal, offscreen, webgl.
After some investigation, I think it is a problem with the installation of QT.
So I uninstalled Qt and pyqt:
brew uninstall qt
brew uninstall pyqt
python3 -m pip uninstall pyqt5
And then reinstall it all:
brew install qt
brew install pyqt
python3 -m pip install pyqt5
But I still have the same issue.
Does anyone know how can I fix this issue, please?