Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix "could not find or load the Qt platform plugin windows" while using Matplotlib in PyCharm

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?

enter image description here

like image 507
Daivik Paul Avatar asked Feb 02 '17 04:02

Daivik Paul


People also ask

Can't find or load the Qt platform plugin windows python?

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.

Where is Qt plugin path?

The Plugin Directory In Qt, when an application starts, the application's executable directory is the base directory where Qt searches for plugins. For example, on Windows, if the application is in C:\Program Files\MyApp and it has a style plugin, Qt looks in C:\Program Files\MyApp\styles .


1 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 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 Library\plugins subdir (here c:\ProgramData\Anaconda3\Library\plugins) 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:\Users\chris\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64) fixed the problem for both programs.

like image 58
cxxl Avatar answered Oct 03 '22 04:10

cxxl