Skip to content

Importing cv2 prevents matplotlib from working  #386

Closed
@TahaDz

Description

@TahaDz

System information (version)

  • OpenCV => 4.4.0.
  • Operating System / Platform => ubuntu 20.04 lts
  • Python => 3.8
  • PyQt : 5.15.0
  • Matplotlib version: 3.3.1

Detailed description

Hello,
i used to work with matplotlib and opencv normally until i installed PyQt, whenever i import cv2 in the same file as matplotlib, matplotlib fuctions don't work (i tried in terminal and pycharm)
here is an example of the code :

import matplotlib
import matplotlib.pyplot as plt
import cv2
plt.plot(range(5))
plt.show()

that's what i get :

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

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/taha/.local/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, webgl.

Aborted (core dumped)

i reported this ISSUE problem to matplotlib packagers but they said they cant do anything from their side.

another thing is that i am using cv2 for a small animation, whenever i execute the code it works normally but it prints this message :

Qt: Session management error: None of the authentication protocols specified are supported

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions