Skip to content
Advertisement

My PyQt application not works with error – This application failed to start because no Qt platform

I developed a Python program using PyQt5 in Windows 10, and it works very well. Then i made it into .exe file with pyinstaller, but it failed and gave me an error.

This application failed to start because no Qt platform plugin could be initialized.
Reinstalling the application may fix this problem.

Available platform plugins are: minimal, offscreen, webgl, windows.

I searched for similar problems in here and google, but i couldn’t find the same problem – running .py works well but .exe failed.

Followings are what i have tried:

  • Placing platforms folder in the same directory with .exe file.
  • Setting environment variable QT_QPA_PLATFORM_PLUGIN_PATH. (it was already set.)

Advertisement

Answer

First, try the latest version of Pyinstaller because it has some new fixes for PyQt5. Second try to install latest version of pyqt5 with pip install -U pyqt5. Last but not least, don’t use UPX with PyQt5 because it can’t properly compress all DLLs.

So you can simply freeze your application without any problem just run: pyinstaller -F --noupx <script_name>.py.

If you still have problem replace the files in bin and plugins directories in C:UsersUSERNAMEAppDataRoamingpyinstallerbincache00_py37_64bitpyqt5qt

from

C:Program FilesPython37Libsite-packagesPyQt5Qt

and run pyinstaller <script_name>.spec

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement