Solve Matplotlib and PyCharm Error – could not find or load the Qt platform plugin windows

Matplotlib and PyCharm Error – could not find or load the Qt platform plugin windows is an error which occurs when using matplotlib in PyCharm.

In this article I am going to explain why the error is happening and how to install Selenium properly without getting the error again. Also we are going to check out other solutions that may work for your particular case.

Explaining the Matplotlib and PyCharm Error – could not find or load the Qt platform plugin windows

This error occurs to a lot of people when using matplotlib in PyCharm.

The error message should look like the error in the example bellow, make sure you have the same error message in order to avoid confusion.

                                                                       #
could not find or load the Qt platform plugin windows
                                                                       #

Bellow are the solutions which worked for me and will help you to successfully …

Solution 1 : Fix for PySide2 and PyQt5 users.

This solution is for developers who are using PySide2 and PyQt5. First of all you should navigate to the following directory.

                                                                       #
\Anaconda3\Library\plugins\platforms\
                                                                       #

leave that folder open and then navigate to this one.

                                                                       #
\Anaconda3\Lib\site-packages\PySide2\plugins\platforms\
                                                                       #

Copy the file bellow. And past it to the directory \Anaconda3\Library\plugins\platforms\

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

Then do the same for the next two files, bellow.

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

The problem should be gone by now. If that is not the case check out the solution bellow.

Solution 2 : use the ‘TKAgg’ backend

Matplotlib uses many backends like: QtAgg, TkAgg and WebAgg. In this example we will try to use the ‘TKAgg’ backend.

You can switch the backend to using ‘TKAgg’ using the code bellow.

                                                                       #
import matplotlib
matplotlib.use('TKAgg')
                                                                       #

In case the solution above does not solve your problem, try the last solution.

Solution 3 : for anaconda users.

This solution is only for anaconda users, start by opening the anaconda prompt.

First, run the command bellow in order to remove qt

                                                                       #
conda remove qt
                                                                       #

Second, remove pyqt by using the command bellow

                                                                       #
conda remove pyqt 
                                                                       #

Finally, use the commands bellow to intall both qt and pyqt

                                                                       #
conda install qt 
conda install pyqt
                                                                       #

I hope the fix above fixed your problem, good luck with the scripts to come.

If the solutions above helped you, consider supporting us on Kofi, any help is appreciated.

Summing-up

The article is over, I hope I have been able to help you solve this error or at least guide you in the right direction, check out other solutions to different errors you can do that by using the search bar on top of this page.

Keep learning, keep coding guys, cheers. If you want to learn more about Python, please check out the Python Documentation : https://docs.python.org/3/