Ellisein
Ellisein

Reputation: 1028

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:

Upvotes: 2

Views: 2376

Answers (1)

Masoud Rahimi
Masoud Rahimi

Reputation: 6051

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:\Users\USERNAME\AppData\Roaming\pyinstaller\bincache00_py37_64bit\pyqt5\qt

from

C:\Program Files\Python37\Lib\site-packages\PyQt5\Qt

and run pyinstaller <script_name>.spec

Upvotes: 1

Related Questions