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

Viewed 20582

I read a lot of questions and answers related to this issue. However, none of them solved my problem.

I would like to point out that i am using the 5.12.2 of Qt. In addition, i tried to generate .exe files using windeployqt command (Calling it via the cmd).

So, i have two different qt application (2 .exe files). I transfer them in a different windows machine with no Qt installation. One .exe file is running correctly however the other one gives me back the error related to the qt platform plugin "Windows".

I would like also to point out, that the running exe is produced using Qt 5.12.2 (MinGW 7.3.0 64-bit). For the problematic exe, the 5.12.2 (MinGW 7.3.0 32-bit) is used.

Do you know what will be the problem?

PS. i double check that the qwindows.dll is in the platforms folder. I also tried to put this dll in the same folder as the exe file as well as in a sub-folder called plugins (based on some answers find around the web.)

Thanks a lot,

2 Answers

I encountered this issue with PyQt5 5.11.3, Windows 10, Python 3.7.3; I got a similar error message:

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.

I set the following environment variable and then run the application. This Method had solved my question, I hope it is helpful for you:

name:  QT_QPA_PLATFORM_PLUGIN_PATH
value: C:\Users\"your own user 
name"\AppData\Local\Programs\Python\Python37\Lib\site- 
packages\PyQt5\Qt\plugins\platforms

Are these exe files in the same folder ? If so you need to put the in 2 different folders as they will not use the same DLLs (including qwindows.dll). One exe needs 32-bit DLLs and the other one 64-bit DLLs.

If they are already in 2 seperate folders, make sure you have run the correct windeployqt on each of them.

You need to use the windployqt.exe from your "Qt 5.12.2 (MinGW 7.3.0 64-bit)" installation on the 64-bit exe. And use the windployqt.exe from your "Qt 5.12.2 (MinGW 7.3.0 32-bit)" installation on the 32-bit exe.

Also be sure to copy the Qt5Core.dll using windeployqt and not by doing a manual copy/paste. The reason is that windeployqt patches Qt5Core.dll when copying it so that it searches plugins relatively to your exe.

Related