How to fix qt.qpa.plugin: Could not find the Qt platform plugin "windows" in "" error
-
@jsulm said in How to fix qt.qpa.plugin: Could not find the Qt platform plugin "windows" in "" error:
os.environ["QT_DEBUG_PLUGINS"] = "1"
How can i set it in the terminal?
-
Can you retry with an environment stored in a path without space or accented character ?
-
@SGaist How can i do that? My brother happened to be at home when this pc arrived so he made the username his name which contains Ö and Ğ characters... I tried to change the username several times but it never changed on the terminal so i really don't know what to do. Maybe there is another way that i can do what you're saying?
-
Install your python environment in a folder starting from the root of your disk. For example "C:/Code/name_of_your_environment".
-
Install your python environment in a folder starting from the root of your disk. For example "C:/Code/name_of_your_environment".
-
How did you install Python ?
How are you managing your virtual environments ? -
Then I would recommend reconsidering that modus operandi.
-
@SGaist I have never messed with environments, i installed python from its site and used it globally. All of my modues are also installed globally.
@Gokalp said in How to fix qt.qpa.plugin: Could not find the Qt platform plugin "windows" in "" error:
i installed python from its site
Which site?
Using Python installer from official Python website allows you to select the installation folder. -
@Gokalp said in How to fix qt.qpa.plugin: Could not find the Qt platform plugin "windows" in "" error:
i installed python from its site
Which site?
Using Python installer from official Python website allows you to select the installation folder. -
So what happens now ?
-
Might be the space in the path.
-
I know it is looks like not an answer but stupid mistake, but I step on that rakes ones again and according to some questions on "StackOverflow" not only me.
I placed.exe
file alongside with all.dlls
bywindeployqt
and with folderplugins
containing my plugin. The problem appears when I load plugin in my app. Solution is pretty simple: I runwindeployqt
for my.exe
but myplugin.dll
requires own specific dlls and I didn't place them along. Putting all.exe's
andplugin's
dlls together helped me to get rid of that message. -
An answer from ChatGPT just in case someone else finds it useful:
**It seems like the application cannot find the Qt platform plugin, specifically the "windows" plugin, from its current location.
Here's a potential solution for this issue:
-
First, make sure that the platforms directory from your Qt installation is included in your application's distribution. The platforms directory will be located under your QT installation directory like
<QtDirectory>/plugins/platforms/
. In this directory, you should find a file calledqwindows.dll
. This file is the Qt platform plugin for Windows. It is essential to running any Qt application on Windows. -
Copy the entire platforms directory, and put it in the same directory as your application's executable.
Here's an example of what your directory structure should look like:
- YourApp.exe - platforms/ - qwindows.dll - Other Qt DLLs like Qt5Core.dll, Qt5Gui.dll, etc.
Make sure to include any other required DLLs in the main directory (the same place where YourApp.exe is located). These will typically include the ones you said you've already copied: Qt5Core.dll, Qt5Gui.dll, and so on, depending on what modules your application uses.
When your application starts up, it will look for the platforms directory relative to its location. It will then load the platform plugin from there.
If you've done this and it still doesn't work, you might need to make sure the application is being run with its working directory set to the directory containing the executable and the platforms directory. It's possible that the application is being started with a different working directory, and so it's not finding the platforms directory even though it's there. You can typically set the working directory in whatever method you're using to start the application.**
-
-
An answer from ChatGPT just in case someone else finds it useful:
**It seems like the application cannot find the Qt platform plugin, specifically the "windows" plugin, from its current location.
Here's a potential solution for this issue:
-
First, make sure that the platforms directory from your Qt installation is included in your application's distribution. The platforms directory will be located under your QT installation directory like
<QtDirectory>/plugins/platforms/
. In this directory, you should find a file calledqwindows.dll
. This file is the Qt platform plugin for Windows. It is essential to running any Qt application on Windows. -
Copy the entire platforms directory, and put it in the same directory as your application's executable.
Here's an example of what your directory structure should look like:
- YourApp.exe - platforms/ - qwindows.dll - Other Qt DLLs like Qt5Core.dll, Qt5Gui.dll, etc.
Make sure to include any other required DLLs in the main directory (the same place where YourApp.exe is located). These will typically include the ones you said you've already copied: Qt5Core.dll, Qt5Gui.dll, and so on, depending on what modules your application uses.
When your application starts up, it will look for the platforms directory relative to its location. It will then load the platform plugin from there.
If you've done this and it still doesn't work, you might need to make sure the application is being run with its working directory set to the directory containing the executable and the platforms directory. It's possible that the application is being started with a different working directory, and so it's not finding the platforms directory even though it's there. You can typically set the working directory in whatever method you're using to start the application.**
-
-
I had the same problem using virtual environment and pyqt5. This solved the problem:
set "QT_PLUGIN_PATH=%VIRTUAL_ENV%\Lib\site-packages\PyQt5\Qt5\plugins"
and I added this to the virtualenv activation script
.... @set "PATH=%VIRTUAL_ENV%\Scripts;%PATH%" @set "QT_PLUGIN_PATH=%VIRTUAL_ENV%\Lib\site-packages\PyQt5\Qt5\plugins" @if defined _OLD_CODEPAGE ( ....