I'm trying to use OpenCV with PyQt5 on Linux, but encountering Qt compatibility issues. When I install opencv-python, I get Qt platform plugin errors that prevent the application from starting. When I switch to opencv-python-headless, the application runs but cv2.imshow() doesn't work.
I expect OpenCV windows to display properly alongside my PyQt5 application, but instead:
With
opencv-python: Qt platform plugin "xcb" initialization fails.With
opencv-python-headless: Application runs butcv2.imshow()shows no windows.
Error messages:
- With
opencv-python:
QObject::moveToThread: Current thread (0x37cc2f70) is not the object's thread (0x37a70930).
Cannot move to target thread (0x37cc2f70)
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/jahid/airsim_env/airsim_env/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.
Available platform plugins: xcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl.
Aborted (core dumped)
- With
opencv-python-headless:
No errors, but cv2.imshow() creates no visible windows.
QObject::moveToThreadwarning for a (I assume) trivial img display script.