Hi everyone !
Thank you Martin for you great work in this website and book !
I’m working on Python “modernization” (a.k.a. “take-my-old-soft-in-Py2.7-Qt4-to-make-it-great”).
I never had troubles using PyQt5 or PySide2/6 (depending on the license we wish for the project), but I have now trouble with PyInstaller.
Indeed, I made packaging for few projects (mostly with PyQt5), but I recently tried with PySide6, and it does not work. The packaging itself seems to work, but then when I run the program, I get the error:
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Abandon (core dumped)
Do you have any idea/trick ? I already know that the support of PySide2/6 by PyInstaller is only partial (which give me the answer …), but I guess we can find a workaround
Hi @samperturbe5108 welcome to the forum!
To be honest, I wouldn’t have expected you to get so far – I didn’t think PyInstaller was working yet!
The issue with the plugins folder is well known though – I see on this issue that you can get around it by manually passing the location as a data argument to PyInstaller, e.g.
PYTHON_DIRECTORY with the location of the Python install you’re using PySide6 with. Or for PyQt6 –
--add-data "PYTHON_DIRECTORY/Lib/site-packages/PyQt6/sip.cp38-win_amd64.pyd;PyQt6/sip.pyd" --add-data "PYTHON_DIRECTORY/Lib/site-packages/PyQt6/Qt6;PyQt6/Qt6"
Can you try that out and see if it works for you?
Thank you Martin !
I already tried this solution, but without success. By the way for Linux/Unix, better to use ‘:’ instead of ‘;’ (see this issue).
I will come back to an old ‘cx_freeze’ for the moment I think. But definitely PyInstaller is worth trying … and the ‘–onefile’ option is very convenient.