matplotlib | QObject::moveToThread: Current thread (0x831f000) is not the object's thread (0x95b40e0). Cannot move to target thread (0x831f000)

735 views Asked by At

There were existing posts regarding this error, but not in conjunction with using matplotlib.

QObject::moveToThread: Current thread (0x831f000) is not the object's thread (0x95b40e0).
Cannot move to target thread (0x831f000)

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/me/miniconda3/envs/venv/lib/python3.9/site-packages/cv2/qt/plugins" 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: xcb, eglfs, minimal, minimalegl, offscreen, vnc, webgl.

Aborted (core dumped)
1

There are 1 answers

0
DanielBell99 On BEST ANSWER

Setting the environment variable QT_PLUGIN_PATH, in terminal, may resolve the error:

export QT_PLUGIN_PATH=/home/me/miniconda3/envs/venv/lib/python3.9/site-packages/cv2/qt/plugins

If not, install the dependencies:

sudo apt-get install libxcb1
pip install pyqt5