Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""



  • Hi. So I compiled a simple PySide6 UI Python file using pyinstaller. When I run the exe, it gave me this error:

    qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""
    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
    

    But when I run my source code file, my UI works just fine. Any help would be appreciated.



  • @Galax
    Set environment variable QT_DEBUG_PLUGINS=1, run your application, and look at the end of the diagnostic output for the reason.



  • @Galax
    Set environment variable QT_DEBUG_PLUGINS=1, run your application, and look at the end of the diagnostic output for the reason.



  • This post is deleted!


  • @JonB said in qt.qpa.plugin: Could not find the Qt platform plugin "windows" in "":

    QT_DEBUG_PLUGINS

    I'm having the same problem, @Galax How did you fix the issue? I added the qt debug to my env path
    env = os.environ env.setdefault("QT_DEBUG_PLUGINS","1")
    And run >
    sub = Popen(["pyinstaller", appName + ".spec"], env=env)
    I've got some warning like >

    97 WARNING: Several hooks defined for module 'win32ctypes.core'. Please take care they do not conflict.
    6693 WARNING: lib not found: shiboken6.abi3.dll dependency of s:\01_code\pyenv\lib\site-packages\PySide6\QtGui.pyd
    6716 WARNING: lib not found: shiboken6.abi3.dll dependency of s:\01_code\pyenv\lib\site-packages\PySide6\QtNetwork.pyd
    6740 WARNING: lib not found: shiboken6.abi3.dll dependency of s:\01_code\pyenv\lib\site-packages\PySide6\QtCore.pyd
    6763 WARNING: lib not found: shiboken6.abi3.dll dependency of s:\01_code\pyenv\lib\site-packages\PySide6\QtWidgets.pyd
    

    But dunno how to bite them. Any hints?



  • I think the problem is PySide6 is not compatible yet with pyinstaller.

    https://doc.qt.io/qtforpython/deployment-pyinstaller.html

    "
    Status of Qt 6 Support¶

    As of March 2021, Qt 6 is not supported yet. PyInstaller is unable to properly deploy Qt; the Qt plugins are not copied. With that, using –onefile is not possible.

    It is possible to use PyInstaller for the non –onefile case though by manually copying the Qt plugins, QML imports and translations into the dist directory after running PyInstaller.

    On Windows, this can be achieved by running the windeployqt tool from the Qt SDK on the Qt libraries present in the dist directory, for example:

    windeployqt dist\app\Qt6Widgets.dll
    

    "


Log in to reply