3

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,

Elena Valari
  • 173
  • 2
  • 2
  • 11

2 Answers2

2

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
Hasitha Jayawardana
  • 2,326
  • 4
  • 18
  • 36
XinHu
  • 21
  • 3
  • 1
    Didn't work for me unfortunately. Although I had the PyQt5 path elsewhere in an Anaconda installation. Exactly what file is in the `\platforms\` folder that you are pointing at? – Colin Apr 28 '20 at 13:58
  • 1
    @Colin running with conda env i set it to ....\Anaconda3\envs\\Library\plugins\platforms. However I'm not sure that this is the best solution to change the PATH environment – skibee Jul 30 '20 at 14:05
0

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.

Benjamin T
  • 8,120
  • 20
  • 37