Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/surbhi/.local/lib/python3.8/site-packages/cv2/qt/plugins" even though it was found. #447

Closed
surbhi1986 opened this issue Feb 11, 2021 · 7 comments

Comments

@surbhi1986
Copy link

Hi I was using mmdetection for custom data, after training i saved the model.
But during testing on single image i am getting error during show which is given please. Please help guys.

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

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

@asmorkalov
Copy link
Collaborator

asmorkalov commented Feb 16, 2021

The error message means that OpenCV cannot initialize UI session, e.g. the program started over SSH without X forwarding. Alternative reason: mix of different Qt versions in the same app. Please ensure that you have X forwarding enabled, if you use SSH and provide ldd tool output for OpenCV binary (.so file in package).

@asmorkalov
Copy link
Collaborator

@skvark
Copy link
Member

skvark commented Feb 16, 2021

There is most likely a conflicting Qt installation somewhere. Installing opencv-python-headless instead of opencv-python usually fixes this. If GUI features are needed (imshow), then the conflicting Qt (such as PyQt) needs to be removed.

@shuang1204
Copy link

我安装完opencv-python-headless,又出现了新的问题,cv2.error: OpenCV(4.5.1) /tmp/pip-req-build-tk9iuyva/opencv/modules/highgui/src/window.cpp:634: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvNamedWindow
'请问该怎么解决呀@Olli-Pekka Heinisuo skvark

@asmorkalov
Copy link
Collaborator

@shuang1204 opencv-python-headless is OpenCV version built without UI support and "The function is not implemented" exception is designed behavior. Use opencv-python package, if you need UI support.

@kivancagaogluu
Copy link

There is most likely a conflicting Qt installation somewhere. Installing opencv-python-headless instead of opencv-python usually fixes this. If GUI features are needed (imshow), then the conflicting Qt (such as PyQt) needs to be removed.

This works on Ubuntu 21.10 Python 3.9.7 PyQt5 5.15.6

@swetapandey-12
Copy link

Error is solve but what if we import cv2 for futher use , it showing module not found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants