Error "could not find or load windows of Qt platform plugins" when using matplotlib in pycharm

I get the error “could not find or load windows of Qt platform plugins” when using matplotlib in PyCharm.

How can i solve this?

enter image description here

+23
source share
16 answers

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 received 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 did not fix this.

The following helped (found here ): find the Anaconda directory and set the Library\plugins subdirectory (here c:\ProgramData\Anaconda3\Library\plugins ) as the QT_PLUGIN_PATH environment QT_PLUGIN_PATH in Control Panel / System / Advanced system settings / Environment variables,

After setting the variable, you may need to restart PyCharm if the change has no immediate effect.

And voila!

Update: Despite the fact that the Python command line worked after this, TexWorks (which also uses Qt) gives an error message very similar to this. Setting QT_PLUGIN_PATH to a directory containing the Qt libraries of the TexWorks library (here C:\Users\chris\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64 ) fixed the problem for both programs.

+19
source

I found that this was caused by the presence of MiKTeX binaries in my PATH variable; and the wrong Qt dlls were found. I just needed to rearrange the PATH entries.

( Dependency Walker is such a useful tool.)

+13
source

I had a similar problem with PyCharm, where everything worked fine on the main startup, but not in the debugger, getting the same error message. This happened to me because I moved the Anaconda installation to a different directory. The debugger launches and checks the qt.conf file, which is located in the same place as python. This location can be found by running import sys; print sys.executable import sys; print sys.executable import sys; print sys.executable import sys; print sys.executable . I found this solution through a bunch of web searches, and it was buried deep here . The qt.conf file must have the correct paths for the debugger to work.

My qt.conf files in notepad look like this:

 [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 
+8
source

If PyQt5 and PySide2 , I solved the problem

Copy the following files

 \Anaconda3\Lib\site-packages\PySide2\plugins\platforms\qminimal.dll \Anaconda3\Lib\site-packages\PySide2\plugins\platforms\qoffscreen.dll \Anaconda3\Lib\site-packages\PySide2\plugins\platforms\qwindows.dll 

in

 \Anaconda3\Library\plugins\platforms\ 
+6
source

I tried the following at Anaconda prompt and solved this problem:

conda remove qt

conda remove pyqt

conda install qt

conda install pyqt

+5
source

Pycharm console or debugger showing this problem - Could not find or load Qt platform plugin windows

Reason - The python exe file may be located elsewhere for the Pycharm interpreter, you can manually select it in the file, settings, interpreter.

Decision -

  • Set the working directory. File → Settings-> Build, Run, Deploy → Console → Python Console → Working Directory. Install it in the parent directory, where all your codes are present.

  • Open Control Panel → System Settings → Advanced System Settings → Environment Variables → New. Set variable name: QT_PLUGIN_PATH , variable directory: Users \\ Appdata \ Local \ Continuum \ Anaconda2 \ Library \ plugins

  • Restart Pycharm.

+4
source

If you want to visualize your matplotlips in an alternative way, use another backend that generates graphs, charts, etc.

import matplotlib matplotlib.use('TKAgg')

It worked for me.

+4
source

I found a solution that worked for me, follow the link below. This solution includes a piece of code that needs to be added before importing any modules from the Pyside2 or PyQt5 package.

Code snippet (also available in 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 do not know if this is appropriate or not, but I have already added the QT_PLUGIN_PATH environment variable to the system.

#

The above solution allowed me to test PySide2 scripts in IDLE. However, I came across the same error log while trying to run a batch script (exe). With some fine debugging, it is obvious that the plugin folder itself is missing. I fixed the problem by adding the plugins folder in the appropriate place. "C: \ Users \ xxxx.spyder-py3 \ My_QtProjects \ Project 1 \ dist \ MyQt_1 \ PySide2 \"

+2
source

On Windows

1- Copy the plastforms folder: C: \ Users \% USERNAME% \ AppData \ Roaming \ pyinstaller \ bincache00_py35_64bit \ pyqt5 \ qt \ plugins \ platform

2- Insert the folder platform into the folder with the .exe file

Example: c: \ MyFolder \ yourFile.exe c: \ MyFolder \ platform

+1
source

I copy the folder \ Anaconda3 \ Library \ plugins \ platform to \ $ \, where $ represents the folder of the interpreter of your project (for example: "\ project \ anaconda_env \ Scripts \"), because PyCharm calls python.exe in this folder, not one in \ Anaconda3. and solve my problem.

+1
source

You may need to copy the “plugins” file to “Anaconda3 \ Library” (for example, on my computer “S: \ Anaconda3 \ Library \ plugins") to the same path of your .exe file.

0
source

Just add the system variable:

QT_QPA_PLATFORM_PLUGIN_PATH and set its value to C: \ Python34 \ Lib \ site-packages \ PyQt4 \ plugins \ platform

Voila. Done

0
source

In my case, I had several combined problems to run PyQt5 on Windows, see DLL loading error while importing PyQt5

-one
source

SOLUTION FOR WINDOWS USERS

Create a new environment variable with:

name: QT_PLUGIN_PATH path: C: \ yourpythonpath \ Lib \ site-packages \ PyQt5 \ Qt \ plugins

after that exe file will work

-one
source

copy the platforms from Anaconda3 \ Library \ plugins and put them into Anaconda3. for env, place the platforms in a specific env folder \

-one
source

I had the same problem with the Qt 5.9 btscanner.exe example . What works in my case:

  1. Create the folder where btscanner.exe is located (my is c: \ temp \ BlueTouth )
  2. Run windeployqt.exe from the command line as follows: c: \ qt \ qt5.9.0 \ msvc2015 \ bin \ windeployqt c: \ temp \ BlueTouth / * windeplyqt is the standard Qt tool for packaging your application with any necessary libraries or additional files and ready to deploy to another computer * /

  3. The result should be something like this:

 C:\temp\BlueTouth\btscanner.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:\temp\BlueTouth\translations... 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... 
  1. If you look at the c: \ temp \ BlueTouth folder , you will see iconengines folders , image formats, platforms, translations, and D3Dcompiler_47.dll, libEGL.dll, libGLESV2.dll, opengl32sw.dll, Qt5Bluetouth.dll, Qt5Core.dll folders, Qt5Gui.dll, Qt5Svg.dll, Qt5Widgets.dll .

These are all the files and folders needed to run btscanner.exe in this or another machine. Just copy the entire folder to another machine and run the file.

-one
source

Source: https://habr.com/ru/post/1014639/


All Articles