Qt for python not working: Spyder not launching and matplotlib unable to plot

Question:

I am running Windows. I have Anaconda and several environments there, I use Spyder, and also Visual studio Code.
After updating packages (many, I cannot really tell which ones), spyder cannot be launched anymore. I get a window error with the following message.

qt.qpa.plugin: Could not load the Qt platform plugin "windows" in ""
even though it was found. This application failed to start because no
Qt platform plugin could be initialized. Reinstalling the application
may fix this problem.

Available platform plugins are: windows, direct2d, minimal, offscreen,
webgl.

I can open visual studio code, but trying to show plots from matplotlib using matplotlib.pyplot.show() (that has qt as default plotter) it shows almost the same error on the console,

QObject::moveToThread: Current thread (0x2844e951fa0) is not the
object’s thread (0x2844e952a40). Cannot move to target thread
(0x2844e951fa0)

qt.qpa.plugin: Could not load the Qt platform plugin "windows" in ""
even though it was found. This application failed to start because no
Qt platform plugin could be initialized. Reinstalling the application
may fix this problem.

Available platform plugins are: windows, direct2d, minimal, offscreen,
webgl.

Qt is installed pyqt5 is installed in all the environments I have, and also in system’s python.

I did reinstall all anaconda and didn’t help. I also added the qt paths to the environment variables. But still does not work…

Any idea?

Asked By: myradio

||

Answers:

I am surprised I didn’t find this before.
The solution in my case was simply to install pyside6,

So, running

pip install PySide6

on my conda enviroment did the trick. I hope this helps someone.

Answered By: myradio
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.