I am getting the error «could not find or load the Qt platform plugin windows» while using matplotlib in PyCharm.
How can I solve this?
the Tin Man
157k41 gold badges211 silver badges300 bronze badges
asked Feb 2, 2017 at 4:59
4
I had the same problem with Anaconda3 4.2.0 and 4.3.0.1 (64-bit). When I tried to run a simple program that uses matplotlib, I got this error message:
This application failed to start because it could not find or load the Qt platform plugin "windows"
Reinstalling the application may fix this problem.
Reinstalling didn’t fix it.
What helped was this (found here):
Look for the Anaconda directory and set the Libraryplugins
subdir (here c:ProgramDataAnaconda3Libraryplugins
) as environment variable QT_PLUGIN_PATH
under Control Panel / System / Advanced System Settings / Environment Variables.
After setting the variable you might need to restart PyCharm, if the change does not have an immediate effect.
Even though after that the command line Python worked, TexWorks (which uses Qt as well) displayed an error message very much like it. Setting the QT_PLUGIN_PATH
to the directory containing TexWorks’ Qt DLLs (here C:UserschrisAppDataLocalProgramsMiKTeX 2.9miktexbinx64
) fixed the problem for both programs.
the Tin Man
157k41 gold badges211 silver badges300 bronze badges
answered Feb 14, 2017 at 16:40
cxxlcxxl
4,6983 gold badges30 silver badges52 bronze badges
3
If you want to visualize your matplotlibs in an alternative way, use a different backend that generates the graphs, charts etc.
import matplotlib
matplotlib.use('TKAgg')
This worked for me.
the Tin Man
157k41 gold badges211 silver badges300 bronze badges
answered Aug 17, 2018 at 11:27
2
If you are running PyQt5 and PySide2, this solved the problem for me:
Copy the following files:
Anaconda3Libsite-packagesPySide2pluginsplatformsqminimal.dll
Anaconda3Libsite-packagesPySide2pluginsplatformsqoffscreen.dll
Anaconda3Libsite-packagesPySide2pluginsplatformsqwindows.dll
to:
Anaconda3Librarypluginsplatforms
the Tin Man
157k41 gold badges211 silver badges300 bronze badges
answered Sep 11, 2018 at 18:16
Osama AdlyOsama Adly
4915 silver badges4 bronze badges
1
I tried the following at Anaconda’s prompt, and it solved this problem:
conda remove qt
conda remove pyqt
conda install qt
conda install pyqt
the Tin Man
157k41 gold badges211 silver badges300 bronze badges
answered Mar 4, 2018 at 5:25
sillysilly
8679 silver badges9 bronze badges
3
I found that this was being caused by having the MiKTeX binaries in my PATH variable; and the wrong Qt dll’s were being found. I just needed to re-arrange the PATH entries.
(Dependency Walker is such a useful tool.)
answered Apr 20, 2018 at 7:52
I had a similar problem with PyCharm where things worked great in main run but not in debugger, getting the same error message. This happened for me because I had moved my Anaconda installation to a different directory. The debugger goes and checks a qt.conf file that is located at the same place as python. This location can be found by running import sys; print sys.executable
. I found this solution through a pile of web searches and it was buried deep here. The qt.conf file needs to have correct paths for debugger to work.
My qt.conf files looks like this in notepad:
[Paths]
Prefix = E:/python/Anaconda3_py35/Library
Binaries = E:/python/Anaconda3_py35/Library/bin
Libraries = E:/python/Anaconda3_py35/Library/lib
Headers = E:/python/Anaconda3_py35/Library/include/qt
answered May 17, 2017 at 17:22
2
Just add a system variable:
QT_QPA_PLATFORM_PLUGIN_PATH
and set its value to
C:Python34Libsite-packagesPyQt4pluginsplatforms
Voilà. Done
the Tin Man
157k41 gold badges211 silver badges300 bronze badges
answered Aug 18, 2019 at 4:45
2
I have found a solution that worked for me. This solution includes a code snippet to add before you import any modules from Pyside2 or PyQt5 package. See «Qt platform plugin «windows» #2″ for more information.
This code snippet is from the link:
import os
import PySide2
dirname = os.path.dirname(PySide2.__file__)
plugin_path = os.path.join(dirname, 'plugins', 'platforms')
os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = plugin_path
from PySide2.QtWidgets import *
'''
Your code goes here
'''
This solution works for PyQt5 and PySide2 modules.
I don’t know if it’s relevant but I added the QT_PLUGIN_PATH
environment variable in the system before.
That solution enabled me to test PySide2 scripts in IDLE.
However, I faced the same error when I tried to run a bundled script (exe).
With some shallow debugging, it’s evident that plugin folder itself is missing. I fixed the problem by adding the plugin folder in the appropriate location:
C:Usersxxxx.spyder-py3My_QtProjectsProject 1distMyQt_1PySide2
the Tin Man
157k41 gold badges211 silver badges300 bronze badges
answered Aug 5, 2019 at 4:22
2
If the Pycharm console or debugger are showing «Could not find or load the Qt platform plugin windows», the Python EXE file may be located at a different location for the PyCharm interpreter. You might manually select it in File -> Settings -> Interpreter.
-
Set the working directory: File -> Settings -> Build, Execution, Deployment -> Console -> Python Console -> Working directory. Set it to the parent directory where your all code exists.
-
Open Control Panel -> System Settings -> Advanced System Settings -> Environment Variables -> New. Set the variable name
QT_PLUGIN_PATH
, Variable Directory:Users<Username>AppdataLocalContinuumAnaconda2Libraryplugins
. -
Restart Pycharm.
the Tin Man
157k41 gold badges211 silver badges300 bronze badges
answered Mar 8, 2018 at 14:14
PranzellPranzell
2,15715 silver badges21 bronze badges
1
I solved it by:
-
Adding a path:
Anaconda3Libsite-packagesPyQt5Qtbin to PATH.
-
Setting an environment variable:
QT_PLUGIN_PATH
asAnaconda3Libsite-packagesPyQt5Qtplugins
orAnaconda3Libraryplugins
. -
Also, you can try:
pyqt = os.path.dirname(PyQt5.__file__) os.environ['QT_PLUGIN_PATH'] = os.path.join(pyqt, "Qt/plugins")
the Tin Man
157k41 gold badges211 silver badges300 bronze badges
answered May 9, 2020 at 2:37
1
First, use the command:
conda remove pyqt qt qtpy
Then install using:
conda install pyqt qt qtpy
This worked for me.
jdaz
5,8542 gold badges21 silver badges32 bronze badges
answered Jul 15, 2020 at 4:21
1
Copy the folder
Anaconda3Librarypluginsplatforms
to
$
where $
is your project interpreter folder. For example:
"projectanaconda_envScripts"
because PyCharm calls the python.exe in this folder, not the one in Anaconda3
.
the Tin Man
157k41 gold badges211 silver badges300 bronze badges
answered Jan 15, 2019 at 16:13
0
SOLUTION FOR WINDOWS USERS
Create new environment variable with:
name: QT_PLUGIN_PATH
path: C:yourpythonpathLibsite-packagesPyQt5Qtplugins
after that exe file will work
answered Apr 10, 2019 at 16:59
PawelPawel
271 bronze badge
1
On Windows:
-
Copy the folder platforms:
C:Users%USERNAME%AppDataRoamingpyinstallerbincache00_py35_64bitpyqt5qtpluginsplatforms
-
Paste the folder platform into the folder location of the file .exe:
Example:
c:MyFolderyourFile.exe c:MyFolderplatforms
the Tin Man
157k41 gold badges211 silver badges300 bronze badges
answered Aug 30, 2018 at 12:27
0
You may need to copy the «plugins» file in Anaconda3Library
. For example, on my computer it is
S:Anaconda3Libraryplugins
to the same path of your .exe file.
the Tin Man
157k41 gold badges211 silver badges300 bronze badges
answered Aug 16, 2017 at 15:31
copy the plugins from PySide2 and paste and overwrite the existing plugins in Miniconda worked for me.
(base) C:ProgramDataMiniconda3Libsite-packagesPySide2pluginsplatforms>copy *.dll C:ProgramDataMiniconda3Librarypluginsplatforms
answered Aug 17, 2020 at 4:33
1
I had the same problem with Anaconda. For me, although not very elegant, the fastest solution was to unistall and reinstall Ananconda completely. After that, everything worked well again.
answered Jul 30, 2021 at 7:55
I have the same issue and fixed in this way
In Anaconda installation folder I went to : (change it to your installed path):
C:ProgramDataAnaconda3Libsite-packagesPySide2
Edit this file by adding the following code lines :
# below the line 23 type.__signature__
pyside_package_dir = os.path.abspath(os.path.dirname(__file__))
dirname = os.path.dirname(__file__)
plugin_path = os.path.join(dirname, 'plugins', 'platforms')
os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = plugin_path
save this file and try again and the issue should be gone
answered Jun 9, 2020 at 4:13
I had the same issue. Following «Activating an environment» in «Managing environments» solved the issue.
In the command line:
conda activate myenv
where myenv=base
for my setup.
the Tin Man
157k41 gold badges211 silver badges300 bronze badges
answered Dec 11, 2019 at 16:17
Please try this in the script
qt_path= os.path.dirname(PyQt5.__file__)
os.environ['QT_PLUGIN_PATH'] = os.path.join(qt_path, "Qt/plugins")
answered Dec 22, 2020 at 4:01
I know everyone above had provided various ways to fix OP’s issue. I just want to add on some suggestions.
By adding the QT_PLUGIN_PATH = C:Users{YOUR_USERNAME}Anaconda3Libraryplugins as your local machine environment variable it helps to fix OP’s PyCharm issue above. However, this will break other systems in your machine like: Dropbox reports missing QT, AMD settings fails to launch(which happens on my side) etc.
Instead of adding QT_PLUGIN_PATH to your machine locally, one can add the environment variable in PyCharm’s python interpreter setting as shown below:
This method not only allow your PyCharm’s python.exe able to search those DLLs but also not breaking other systems’ QT lookup PATH.
Thanks
Dharman♦
29.3k21 gold badges79 silver badges131 bronze badges
answered Jan 2, 2021 at 8:51
1
I installed a package that had a QT-gui that I didn’t need.
So I just removed all the Qt modules from my environment.
pip freeze | grep -i qt
PyQt5==5.15.4
PyQt5-Qt5==5.15.2
PyQt5-sip==12.9.0
QtPy==1.9.0
pip uninstall PyQt5
pip uninstall PyQt5-Qt5
pip uninstall PyQt5-sip
pip uninstall QtPy
Problem solved.
answered May 25, 2021 at 4:53
DuaneDuane
4,1326 gold badges29 silver badges32 bronze badges
if you are using anaconda/miniconda with matplotlib installed.
you’ll have to install uninstall anaconda/miniconda and use miniconda without matplotlib, a fix is to use normal python not anaconda.
it has be a know issue here enter link description here
answered Mar 30, 2022 at 14:12
ironmann350ironmann350
3512 silver badges4 bronze badges
Inspired by Osama Adly, I think this kind of problems are all caused by Anaconda configuration for Qt DLLs on Windows platform.
Just try to install PyQt/PySide in an empty environment besides Anaconda, for example a standalone Python program. You will find that the plugins about platforms are in the site-package directory itself.
For comparation:
site-packagesPyQt6Qt6pluginsplatforms
site-packagesPySide6pluginsplatforms
But it seems that Anaconda contains some software depending on PyQt5 or Qt. Anaconda moves the platforms directory from PyQt5 to another folder and this folder might be contained in the PATH variable when using Anaconda.
Anaconda3Librarypluginsplatforms
This could lead to unneccessary problems. These DLLs reserve the same name across different generation of Qt. For example, when I tried PySide6 in a virtual environment created with Anaconda, its call for DLLs will mistakenly use the Qt5 DLLS rather than the DLLs in its folder.
answered Mar 29, 2022 at 7:00
1
In my situation, I did everything listed above and on other forum post:
- Copying and pasting files
- Adding system variables
- Uninstalling, downloading, and reinstalling programs
- Restarting the computer
- Enabling debugging mode
- Running the source code instead of the compiled program
- Running sfc /scannow
All of this did not work.
In my case, the solution was to update Windows.
The computer was apparently running a very outdated version of Windows (10?)
After 2-3 hours of installing the update, problem solved.
Source/Inspiration: https://www.partitionwizard.com/clone-disk/no-qt-platform-plugin-could-be-initialized.html
answered Nov 17, 2022 at 23:20
I had the same issue with Qt 5.9 example btscanner.exe. What works in my case is:
- Create a folder where is btscanner.exe ( my is c:tempBlueTouth )
-
Run from command prompt windeployqt.exe as follow:
c:qtqt5.9.0msvc2015binwindeployqt c:tempBlueTouth
/* windeplyqt is the standard Qt tool to packet your application with any needed
libraries or extra files and ready to deploy on other machine */ -
Result should be something like that:
C:tempBlueTouthbtscanner.exe 32 bit, release executable
Adding Qt5Svg for qsvgicon.dll
Skipping plugin qtvirtualkeyboardplugin.dll due to disabled dependencies.
Direct dependencies: Qt5Bluetooth Qt5Core Qt5Gui Qt5Widgets
All dependencies : Qt5Bluetooth Qt5Core Qt5Gui Qt5Widgets
To be deployed : Qt5Bluetooth Qt5Core Qt5Gui Qt5Svg Qt5Widgets
Warning: Cannot find Visual Studio installation directory, VCINSTALLDIR is not set.
Updating Qt5Bluetooth.dll.
Updating Qt5Core.dll.
Updating Qt5Gui.dll.
Updating Qt5Svg.dll.
Updating Qt5Widgets.dll.
Updating libGLESV2.dll.
Updating libEGL.dll.
Updating D3Dcompiler_47.dll.
Updating opengl32sw.dll.
Patching Qt5Core.dll...
Creating directory C:/temp/BlueTouth/iconengines.
Updating qsvgicon.dll.
Creating directory C:/temp/BlueTouth/imageformats.
Updating qgif.dll.
Updating qicns.dll.
Updating qico.dll.
Updating qjpeg.dll.
Updating qsvg.dll.
Updating qtga.dll.
Updating qtiff.dll.
Updating qwbmp.dll.
Updating qwebp.dll.
Creating directory C:/temp/BlueTouth/platforms.
Updating qwindows.dll.
Creating C:tempBlueTouthtranslations...
Creating qt_bg.qm...
Creating qt_ca.qm...
Creating qt_cs.qm...
Creating qt_da.qm...
Creating qt_de.qm...
Creating qt_en.qm...
Creating qt_es.qm...
Creating qt_fi.qm...
Creating qt_fr.qm...
Creating qt_gd.qm...
Creating qt_he.qm...
Creating qt_hu.qm...
Creating qt_it.qm...
Creating qt_ja.qm...
Creating qt_ko.qm...
Creating qt_lv.qm...
Creating qt_pl.qm...
Creating qt_ru.qm...
Creating qt_sk.qm...
Creating qt_uk.qm...
- If you take e look at c:tempBlueTouth folder will see
the folders iconengines, imageformats, platforms, translations,
and files D3Dcompiler_47.dll, libEGL.dll, libGLESV2.dll, opengl32sw.dll,
Qt5Bluetouth.dll, Qt5Core.dll, Qt5Gui.dll, Qt5Svg.dll, Qt5Widgets.dll.
These are all of the files and folders need to run btscanner.exe on
this or another machine. Just copy whole folder on other machine and
run the file.
answered Sep 24, 2019 at 13:27
0
copy platforms from Anaconda3Libraryplugins and put it in the Anaconda3.
for env put the platforms in the specific env folder
answered Jul 31, 2019 at 21:31
@hskoglund Restarting my computer after moving C:QtQt5.14.05.14.0mingw73_64bin
to be the first entry (it wasn’t before) solved the problem, now I can see the application’s window, yet I get the following output (which I’m not sure if it’s an error):
Warning: QT_DEVICE_PIXEL_RATIO is deprecated. Instead use:
QT_AUTO_SCREEN_SCALE_FACTOR to enable platform plugin controlled per-screen factors.
QT_SCREEN_SCALE_FACTORS to set per-screen DPI.
QT_SCALE_FACTOR to set the application global scale factor.
QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/libEGL.dll"
"Failed to extract plugin meta data from 'C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/libEGL.dll'"
not a plugin
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qdirect2d.dll"
Found metadata in lib C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qdirect2d.dll, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"direct2d"
]
},
"archreq": 0,
"className": "QWindowsDirect2DIntegrationPlugin",
"debug": false,
"version": 331264
}
Got keys from plugin meta data ("direct2d")
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qminimal.dll"
Found metadata in lib C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qminimal.dll, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"minimal"
]
},
"archreq": 0,
"className": "QMinimalIntegrationPlugin",
"debug": false,
"version": 331264
}
Got keys from plugin meta data ("minimal")
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qoffscreen.dll"
Found metadata in lib C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qoffscreen.dll, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"offscreen"
]
},
"archreq": 0,
"className": "QOffscreenIntegrationPlugin",
"debug": false,
"version": 331264
}
Got keys from plugin meta data ("offscreen")
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qwebgl.dll"
Found metadata in lib C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qwebgl.dll, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"webgl"
]
},
"archreq": 0,
"className": "QWebGLIntegrationPlugin",
"debug": false,
"version": 331264
}
Got keys from plugin meta data ("webgl")
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qwindows.dll"
Found metadata in lib C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qwindows.dll, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"windows"
]
},
"archreq": 0,
"className": "QWindowsIntegrationPlugin",
"debug": false,
"version": 331264
}
Got keys from plugin meta data ("windows")
QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins" ...
QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/haita/Documents/QtProjects/test_cmake/cmake-build-deb
ug" ...
QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/platforms"
...
QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/libEGL.dll"
"Failed to extract plugin meta data from 'C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/libEGL.dll'"
not a plugin
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qdirect2d.dll"
Got keys from plugin meta data ("direct2d")
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qminimal.dll"
Got keys from plugin meta data ("minimal")
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qoffscreen.dll"
Got keys from plugin meta data ("offscreen")
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qwebgl.dll"
Got keys from plugin meta data ("webgl")
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qwindows.dll"
Got keys from plugin meta data ("windows")
QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/haita/Documents/QtProjects/test_cmake/cmake-build-deb
ug/platforms" ...
loaded library "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qwindows.dll"
QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/libEGL.dll"
"Failed to extract plugin meta data from 'C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/libEGL.dll'"
not a plugin
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qdirect2d.dll"
Got keys from plugin meta data ()
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qminimal.dll"
Got keys from plugin meta data ()
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qoffscreen.dll"
Got keys from plugin meta data ()
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qwebgl.dll"
Got keys from plugin meta data ()
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qwindows.dll"
Got keys from plugin meta data ()
QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins" ...
QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/haita/Documents/QtProjects/test_cmake/cmake-build-deb
ug" ...
QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/platformthe
mes" ...
QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platformthemes" ...
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platformthemes/qxdgdesktopportal.d
ll"
Found metadata in lib C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platformthemes/qxdgdesktopportal.dll, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformThemeFactoryInterface.5.1",
"MetaData": {
"Keys": [
"xdgdesktopportal",
"flatpak",
"snap"
]
},
"archreq": 0,
"className": "QXdgDesktopPortalThemePlugin",
"debug": false,
"version": 331264
}
Got keys from plugin meta data ("xdgdesktopportal", "flatpak", "snap")
QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/haita/Documents/QtProjects/test_cmake/cmake-build-deb
ug/platformthemes" ...
QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/styles" ...
QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/styles" ...
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/styles/qwindowsvistastyle.dll"
Found metadata in lib C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/styles/qwindowsvistastyle.dll, metadata=
{
"IID": "org.qt-project.Qt.QStyleFactoryInterface",
"MetaData": {
"Keys": [
"windowsvista"
]
},
"archreq": 0,
"className": "QWindowsVistaStylePlugin",
"debug": false,
"version": 331264
}
Got keys from plugin meta data ("windowsvista")
QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/haita/Documents/QtProjects/test_cmake/cmake-build-deb
ug/styles" ...
loaded library "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/styles/qwindowsvistastyle.dll"
QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/accessible"
...
QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/accessible" ...
QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/haita/Documents/QtProjects/test_cmake/cmake-build-deb
ug/accessible" ...
QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/accessibleb
ridge" ...
QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/accessiblebridge" ...
QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/haita/Documents/QtProjects/test_cmake/cmake-build-deb
ug/accessiblebridge" ...
QLibraryPrivate::unload succeeded on "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/styles/qwindowsvistastyle.dll"
QLibraryPrivate::unload succeeded on "C:/Qt/Qt5.14.0/5.14.0/mingw73_64/plugins/platforms/qwindows.dll"
@Scripteer
Веб дизайнер, интересуюсь python, знаю html,css +-
У меня появилась ошибка когда запускаю python файл, пж помогите не нужно кидать ссылку на форум просто скажите что сделать?
ОШИБКА
C:UsersАндрей>»C:UsersАндрейDesktopCurrency Convertorui.py»
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.
-
Вопрос заданболее двух лет назад
-
11422 просмотра
РЕШЕНИЕ: Найти папку где установлен python, перейти по пути C:UsersАндрейAppDataLocalProgramsPythonPython38Libsite-packagesPyQt5Qtplugins найти тут папку platforms и перенести в папку где находится python
Пригласить эксперта
-
Показать ещё
Загружается…
04 февр. 2023, в 21:37
4500 руб./за проект
04 февр. 2023, в 20:45
1000 руб./за проект
04 февр. 2023, в 20:04
35000 руб./за проект
Минуточку внимания
Description of the issue
When packaging an app which uses PySide6 (which seems to be a recent release, December 2020), the app builds fine but upon execution it crashes with the error qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""
.
This can be fixed by copying over the platforms
folder from [env]Libsite-packagesPySide6plugins
into the pyinstaller dist directory (or where the executable is, if built with --onefile
)
From googling around, it seems like people had this same problem back in the PyQt5 days, and seemed to have been fixed with
this pull request. The reason this might still broken might be that all the checks in pyinstaller/PyInstaller/utils/hooks/qt.py
use an hardcoded «PySide2» string, while the newer package has been renamed to PySide6.
That’s made more likely from the fact that using PySide2 works (noting that all documentation / homepage links for it redirect to PySide6, pretty confusing naming scheme)
Context information (for bug reports)
- Output of
pyinstaller --version
:3.6
- Version of Python: 3.9.1
- Platform: Windows-10-10.0.19041-SP0
- Did you also try this on another platform? Does it work there? Haven’t tried, but likely not
A minimal example program which shows the error
import sys
import PySide6.QtGui
import PySide6.QtCore
from PySide6.QtWidgets import QApplication, QMainWindow
class MainWindow(QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.show()
def main():
a = QApplication(sys.argv)
w = MainWindow()
sys.exit(a.exec_())
if __name__ == "__main__":
main()
Stacktrace / full 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 am implementing qgis 3.4.3 in a custom application, but when I instantiate the QgsApplication() class, I receive the error «Could not find the Qt platform plugin «Windows» in «».
I’ve attempted using various installs of qgis 3.x+ including the standalone installer and OSGeo4W web installer. I currently am sticking with the OSGeo4W web installer installation. I am using a Python 3.7 installation separate from what comes with OSGeo4W and attempting to integrate qgis functionality.
I have followed the instructions in the following QGIS help doc under the section: «Using PyQGIS in Custom Applications»
https://docs.qgis.org/2.18/en/docs/pyqgis_developer_cookbook/intro.html#run-python-code-when-qgis-starts
After attempting to run the script I realized a dll plugin was missing. After some research, I found its the qwindows.dll that qt uses. The qwindows.dll is included in the OSGeo4W installation under: C:OSGeo4WappsQt5pluginsplatforms
I changed the QT_PLUGIN_PATH variable on the local command prompt to include the directory above, but the same error prevailed. I also changed the QT_DEBUG_PLUGINS variable to 1 which printed out the locations Qt is looking for plugins. Interestingly, it wasn’t looking for plugins in the path I specified in the QT_PLUGIN_PATH variable.
Python Code:
import sys
#add qgis python libraries to instance python path in case not added
#at the environment variable %PYTHONPATH% level
sys.path.extend(['C:\OSGeo4W\apps\qgis\python',
'C:\OSGeo4W\apps\Python37\Lib\site-packages'])
from qgis.core import *
# supply path to qgis install location
QgsApplication.setPrefixPath('C:\OSGeo4W\apps\qgis', True)
# create a reference to the QgsApplication
# setting the second argument to True enables the GUI, which we need to do
# since this is a custom application
qgs = QgsApplication([], True)
# load providers
qgs.initQgis()
# Write your code here to load some layers, use processing algorithms, etc.
# When your script is complete, call exitQgis() to remove the provider and
# layer registries from memory
qgs.exitQgis()
Batch File Code to Start Cmd Prompt with Proper Variables:
@echo off
SET OSGEO4W_ROOT=C:OSGeo4W
::Include environment variables set by qgis on startup
call %OSGEO4W_ROOT%bino4w_env.bat
call %OSGEO4W_ROOT%binqt5_env.bat
call %OSGEO4W_ROOT%binpy3_env.bat
@echo off
path %PATH%;%OSGEO4W_ROOT%appsqgisbin
path %PATH%;C:OSGeo4WappsQt5bin
path %PATH%;C:OSGeo4WappsPython37Scripts
path %PATH%;C:OSGeo4WappsPython37
set PYTHONPATH=%PYTHONPATH%;%OSGEO4W_ROOT%appsqgispython
set PYTHONHOME=%OSGEO4W_ROOT%appsPython37
set QT_PLUGIN_PATH=%OSGEO4W_ROOT%appsQt5plugins;%OSGEO4W_ROOT%appsqgisqtplugins
set QT_DEBUG_PLUGINS=1
cmd.exe
I expect to run the python script and receive no errors since I’m pointing to the directory where the qwindows.dll missing plugin is stored. However, I am still receiving the missing windows plugin error.
Here is the actual message with QT_DEBUG_PLUGINS set to 1:
QFactoryLoader::QFactoryLoader() checking directory path «C:/OSGeo4W/apps/qgis/qtplugins/platforms» …
QFactoryLoader::QFactoryLoader() checking directory path «C:/OSGeo4W/apps/Python37/platforms» …
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.
ROS 2 tutorial, Introducing turtlesim and rqt, instructs us to execute the following commands in two cmd windows (I am exercising on Windows 10 platform), ros2 run turtlesim turtlesim_node
and ros2 run turtlesim turtle_teleop_key
. Both commands fails with the 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.
Does this mean that I need to install Qt? If yes, why isn’t Qt included in Foxy release, or, as part of install instruction? Could you provide the pointer where I can download free version of Qt? Once I install Qt, what else do I need to do so that the turtlesim will work successfully? Thanks a lot for the help.
My foxy installation was successful. At the end of the installation, both ros2 run demo_nodes_cpp talker
and ros2 run demo_nodes_py listener
worked. I am just started with the ros2 tutorial. The command set | findstr ROS
produced the following:
ROS_DISTRO=foxy
ROS_LOCALHOST_ONLY=0
ROS_PYTHON_VERSION=3
ROS_VERSION=2
1 Answer
I run into the same problem. In my case (Foxy on Windows 10), the solution was to set the variable QT_QPA_PLATFORM_PLUGIN_PATH to C:devros2_foxybinplatforms, the path to qwindows.dll delivered by ROS2. It was confusing since there is another qwindows.dll file under C:Python38Libsite-packagesPyQt5Qtpluginsplatforms as described by @Izsyvj.
Your Answer
Please start posting anonymously — your entry will be published after you log in or create a new account.
Question Tools
4 followers
Related questions
Я просмотрел все вопросы, которые, по-видимому, связаны с переполнением стека, и ни одно из решений, кажется, не помогает мне.
Я создаю приложение Qt с этой настройкой:
- Windows 7 Professional x64
- Visual Studio 2012
- Qt 5.2.0 построен с помощью
configure -developer-build -debug-and-release -opensource -nomake examples -nomake tests -platform win32-msvc2012 -no-opengl
- проект использует QtSingleApplication (qt-solutions)
- приложение является 32-битным приложением
- qmake запускается со следующими параметрами: — makefile-spec win32-msvc2012
- .pri использует
QMAKE_CXX += /D_USING_V110_SDK71_
Я могу построить и запустить свою программу нормально на моей машине разработки (отмечено выше); я также могу установить и запустить пакет из каталога Program Files на машине разработки.
Когда я устанавливаю и запускаю на машине Windows Vista (несколько машин)
- VC++ redist 2012 11.0.61030.0 установлен
- VC++ redist 2010 10.0.40219 установлен
- плюс 2005, 2008 версии redist
(также терпит неудачу на a чистая установка Windows 7)
Я получаю:
Application failed to start because it could not find or load the QT platform plugin "windows"
Поэтому я последовал инструкциям и добавил a .платформы / каталог, и добавил qwindows.dll (также добавлен qminimal.dll и qoffscreen.dll); я также добавил libEGL.dll, libGLESv2.dll (хотя я не думаю, что они мне понадобятся)
Однажды я добавил qoffscreen.dll теперь я получаю дополнительное сообщение: Available platform plugins are: offscreen
Если я пробегаю через Dependency Walker, я получаю эту ошибку в списке:
GetProcAddress(0x76CA0000 [KERNEL32.DLL], "GetCurrentPackageId") called from "MSVCR110.DLL" at address 0x6AC6FDFA and returned NULL. Error: The specified procedure could not be found (127).
А затем еще ниже получаем the:
GetProcAddress(0x745A0000 [UXTHEME.DLL], "BufferedPaintUnInit") called from "COMCTL32.DLL" at address 0x745FFBF8 and returned 0x745AE18C.
This application failed to start because it could not find or load the Qt platform plugin "windows".
Available platform plugins are: offscreen.
Reinstalling the application may fix this problem.
Есть идеи, как исправить эту проблему dll?
When launching certain apps on Windows, many users receive the “This application failed to start because no Qt platform plugin could be initialized” error. Don’t worry. This post of MiniTool explores several effective troubleshooting methods.
This Application Failed To Start Because No Qt Platform Plugin Could Be Initialized
According to user reports, the “this application failed to start because no Qt platform plugin could be initialized” error can occur with many apps such as OneDrive, Designer, Python, etc. This error often appears after installing a series of Windows updates. Here’s a true example from the answersmicrosoft.com forum:
After a series of recent Windows updates my Surface displays the following error when we log in OneDrive — This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. I have searched the community and followed the responses given to others suffering the same fate but so far this has not resolved the issue. Looking to know what I should attempt next?https://answers.microsoft.com/en-us/windows/forum/all/application-failed-to-start-because-no-qt-platform/205e4259-dcbc-4d72-addb-8e7edb9663e9
Qt is a cross-platform software that was designed to create graphical user interfaces and cross-platform applications on Windows, Linux, macOS, and Android. However, when something went wrong with the Qt platform, you may receive the “This application failed to start because it could not find or load the Qt platform plugin Windows” error.
It seems like reinstalling the application may fix the error. However, some users encounter new errors when reinstalling the app. Don’t worry. Here we explore several effective troubleshooting methods. Let’s try.
How to Fix the “No Qt Platform Plugin Could Be Initialized” Error
After analyzing extensive user reports, we summarize the 6 applicable ways to fix the Qt platform plugin Windows error. You can try them in order until the error gets solved or choose the ones that work best for you.
Fix 1. Replace the Qt Files in the Destination
The first and proven method is to replace the Qt files in the destination folder. Here we take Python for example. To do so, follow the steps below:
Step 1. Press the Win + E keys to open the File Explorer, select This PC, type pyqt5_tools in the search box, and hit Enter.
Step 2. Right-click the pyqt5_tools folder once the search is complete and select Open folder location.
Step 3. Then go to the folder path “PyQt5 > Qt > plugins”, and then open the Plugin folder, right-click the platforms folder, and select Copy.
Step 4. Go to the site-packages folder that you initially opened and go to pyqt5_tools > Qt > bin.
Step 5. Right-click any empty space inside the bin directory and select paste. Then confirm it when you see the “Replace the files in the destination” message.
Now, you can relaunch the app and see if the “this application failed to start Qt platform Windows” message persists.
Fix 2. Perform a Clean Boot
One of the possible reasons for the “this application failed to start Qt platform Windows” error is third-party software conflicts. If you are not sure which app is causing the conflict, you can perform a clean boot (click on the Hyperlink to know the detailed steps). Once you find out the conflicting software, uninstall it and check if the error is fixed.
Fix 3. Check System File Corruption
Sometimes corrupted system files can trigger various errors and issues when running your apps such as the “no Qt platform plugin could be initialized” error. So, we recommend you run an SFC scan or DISM to check system files.
Step 1. Type cmd in the search box, and then right-click Command Prompt and select Run as administrator option.
Step 2. Type the sfc /scannow command in the elevated command prompt and hit Enter. After that, the SFC tool will scan and try to repair the corrupted system files automatically.
Step 3. If the SFC command was unable to repair corrupt system files, you can try running the following DISM commands:
- DISM /Online /Cleanup-Image /CheckHealth
- DISM /Online /Cleanup-Image /ScanHealth
- DISM /Online /Cleanup-Image /RestoreHealth
Fix 4. Reinstall the App
As the error message hints, reinstalling the application may help fix the problem. However, many users cannot uninstall the app smoothly. Don’t worry. We summarize the following 3 applicable ways to reinstall the app. (Here we take reinstalling OneDrive for example)
Uninstall OneDrive via the Run box:
Step 1, Press Win + R keys to open the Run dialog box, and then type the following command in it and hit Enter. Here make sure you replace the OneDriveSetup.exe path with the actual location.
%userprofile%\AppData\Local\Microsoft\OneDrive\Update\OneDriveSetup.exe
Step 2. Once uninstalled, go through the installation steps and restart your computer and check if the error gets fixed. If it fails to uninstall the application, you can try the following 2 methods.
Uninstall OneDrive via CMD:
Step 1. Type cmd in the Run dialog box and press Ctrl + Shift + Enter keys to open the elevated Command Prompt window.
Step 2. Type the following command and hit Enter to uninstall the app. If you are running on a 32-bit system, replace SysWOW64 with System32. This will force uninstalling the app.
- taskkill /f /im OneDrive.exe
- %SystemRoot%\SysWOW64\OneDriveSetup.exe /uninstall
Uninstall OneDrive from Settings:
Step 1. Right-click the Start menu at the bottom left and select Apps and Features.
Step 2. Inside the Applications window, search for OneDrive by name and click the Uninstall button.
Step 3. Then follow the on-screen prompts to complete the uninstallation. After that, you can reinstall the app and check if the error disappears.
Fix 5. Download the Update.xml File of the App
Some users reported that the error can be fixed by downloading the update.xml file of the app. If you can’t reinstall OneDrive via the above method, try this solution. Click here to download the OneDriveSetup.exe file, and run it to install the latest version of OneDrive.
Fix 6. Undo the Recent Changes
Many people reported that “This application failed to start because it could not find or load the Qt platform plugin Windows” error mainly occurs after installing a series of Windows updates. If this scenario applies to you, you can try performing a system restore or uninstalling these updates manually.
Step 1. Press the Win + I keys to open the Settings app, and then select Update & Security > View update history.
Step 2. Click on Uninstall updates, and then right-click the most recent update and select Uninstall. Then follow the on-screen prompts to complete the uninstallation. Then repeat the same procedure to uninstall other Windows updates.
0 / 0 / 1 Регистрация: 13.11.2014 Сообщений: 34 |
|
1 |
|
21.10.2016, 16:45. Показов 22734. Ответов 10
Да, я знаю, что этим вопросом заполнен весь интернет, включая англоязычный. Перечитано много тем и статей. У меня Qt 5.7 и Visual Studio 2015, Windows 8.1 x64. Проблема возникает и при динамической (с переносом на другие компы; у меня на компе с учетом, видимо, всего установленного и прописанного все-таки запускается), и при статической сборке. При построении внутри студии в обоих случаях все хорошо. При статическом варианте qwindows.lib внутри студии подключается при прописывании $(QTDIR)pluginsplatforms в путях к библиотекам. При копировании той же самой папки к exe’шнику и использовании qt.conf (с точкой вместо пути) ничего не меняется. Причем любой (что с .lib из qtbase, что с .dll из msvc2015_64).
__________________
0 |
7275 / 6220 / 2833 Регистрация: 14.04.2014 Сообщений: 26,871 |
|
21.10.2016, 22:52 |
2 |
lib нужен только для компиляции. Ты структуру папок соблюдаешь?
0 |
MattyMatiss 0 / 0 / 1 Регистрация: 13.11.2014 Сообщений: 34 |
||||||||||||
22.10.2016, 12:42 [ТС] |
3 |
|||||||||||
А можно поконкретней? В общем, все как обычно Добавлено через 1 час 11 минут
Если создать переменную QT_QPA_PLATFORM_PLUGIN_PATH и задать путь к папке, где лежит plugins или platforms или qwindows, то пустые кавычки покажут этот путь. Добавлено через 6 минут
Добавлено через 1 минуту
Добавлено через 41 минуту
0 |
188 / 187 / 46 Регистрация: 24.03.2011 Сообщений: 670 |
|
22.10.2016, 13:31 |
4 |
Насколько я знаю, достаточно положить нужные dll’ки (минимум qwindows.dll) в папку platforms рядом с exe-файлом. И у меня это всегда работает. PS
0 |
7275 / 6220 / 2833 Регистрация: 14.04.2014 Сообщений: 26,871 |
|
22.10.2016, 14:04 |
5 |
Попробуй вариант monolit‘а. Не менять никакие пути, qwindows.dll — в platforms рядом с exe, Qt5Core.dll и прочее просто рядом с exe.
0 |
93 / 93 / 33 Регистрация: 17.03.2012 Сообщений: 536 |
|
22.10.2016, 14:28 |
6 |
Тут, кажется, Avazart в каком-то топике выкладывал его софтину для проверки зависимостей.
0 |
0 / 0 / 1 Регистрация: 13.11.2014 Сообщений: 34 |
|
22.10.2016, 14:40 [ТС] |
7 |
qwindows.dll это была одна из первых попыток решения. Ни она (в плагины/платформы), ни она вместе с libEGL.dll не помогли.
0 |
188 / 187 / 46 Регистрация: 24.03.2011 Сообщений: 670 |
|
22.10.2016, 14:43 |
8 |
Возможно, ты не ту версию dll пытаешься приткнуть, даже не знаю. При прочих равных достаточно положить эту dll в указанную мной папку рядом с exe. Пока меня этот способ не подводил ни разу (если все правильно сделано).
0 |
0 / 0 / 1 Регистрация: 13.11.2014 Сообщений: 34 |
|
22.10.2016, 15:19 [ТС] |
9 |
Версия из C:QtQt5.7.05.7msvc2015_64pluginsplatforms.
0 |
7275 / 6220 / 2833 Регистрация: 14.04.2014 Сообщений: 26,871 |
|
22.10.2016, 15:24 |
10 |
Насколько он статический? Даже VC++ Redistributable не нужен?
0 |
0 / 0 / 1 Регистрация: 13.11.2014 Сообщений: 34 |
|
22.10.2016, 15:33 [ТС] |
11 |
Статический он настолько, что на компе, где ничего не установлено, не требует библиотек, сразу начинает ругаться на плагин. На плагин он и у меня орет.
0 |