3

i'm getting the following error message, when trying to call a pyplot.show.

> QObject::moveToThread: Current thread (0x55cb11264ad0) is not the object's thread (0x55cb1226c700).
> Cannot move to target thread (0x55cb11264ad0)

> qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/usr/lib/python3.8/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, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx.

> Aborted (core dumped)

Looking for answers I though it was the same problem as https://www.reddit.com/r/archlinux/comments/d6h3kl/python_qt_cant_import_matplotlibpyplot/ but i just reinstalled a lot of packages(And almost broke the entire system) and Im getting the same error.

And also, matplotlib.pyplot.show() and opencv.imshow() works fine when they are alone, but when i am doing some procesing with opencv and i want to show in pyplot.show() is where the error comes out.

I don't know how to debug Qt as the same as u/tim-hilt done in his post so this is all information that i can give for the moment. I figured out how to do it.

https://pastebin.com/YAgHMQKf

Thanks in advance for any response that i can get.

  • This question deals with a similar issue : https://stackoverflow.com/questions/52337870/python-opencv-error-current-thread-is-not-the-objects-thread – mfit Aug 15 '20 at 08:43
  • opencv and matplot can use different GUI framework and they may have problem to run together - they may need own event loop which can make problem. `threading` could resolve problem but usually GUIs don't like change widgets in different thread. Maybe convert plot to image and use only `opencv` to display it. OR create own GUI to display different object and have only one event loop i – furas Aug 15 '20 at 09:20
  • But it worked a week ago, the problem is that i need to plot graphs and also images so the solution was to use only matplotlib to show them, but now it is not working. – andr3slelouch Aug 15 '20 at 12:46
  • I have used opencv with matplotlib and I use arch linux and I have not had problems, so you should provide a [mre] and point out how you have installed the libraries – eyllanesc Aug 15 '20 at 15:12
  • Well I looks like its more complicated, I have an environment for the project and it just works, so, the real question is how many packages in my arch linux installation are broken? Literally I reinstalled almost any package in my current installation and It doesn't works with the main python of the system environment. If someone can tell me any ideas for posting here for give more information I would be glad to do it. – andr3slelouch Aug 16 '20 at 05:41

0 Answers0