-
Notifications
You must be signed in to change notification settings - Fork 867
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
Any plan to solve conflicts betwen opencv-python and PyQt5 #736
Comments
OpenCV uses QT as imshow backend on some platforms. QT is linked to C++ code and distributed with OpenCV. There is no simple solution to share the same QT object between PyQT and OpenCV. I cannot recommend you something scalable. In case if you manage full setup, you can try to rebuild OpenCV with other backend like GTK on Linux. |
Ran into this issue using tensorflow, mediapipe, and opencv (in notebooks). Very very annoying. Can't use new versions of opencv, and monitor detections at the same time. Even if I am not utilizing matplotlib. Well, I can, but my notebooks get spammed with the |
@bstivers @asmorkalov, Here are some methods,you can try it troubleerror as follow
identifythe clues indicate you should install PyQt5 lib version corresponding with opencv-python lib, the source of opencv-python code line of 12: 4.x/patches/patchQtPlugins
sure, my pyqt + cv2 project work well, enjoy besides, i find opencv-python source have other code snap, how fix it
|
hardcode data_collection_backend.py to use the correct xcb file Issue arises from pyqt5 finding xcb dependency within the cv2 folder instead of its own pyqt5 folder. My old bandaid fix involved renaming /home/screwsorter/.local/lib/python3.9/site-packages/cv2/qt/plugins/platforms to platforms_old But that prevented usage of cv.imshow(). This new fix means we can use both cv2.imshow() and our pyqt5 application GUI. https://stackoverflow.com/questions/68417682/qt-and-opencv-app-not-working-in-virtual-environment opencv/opencv-python#736
hardcode data_collection_backend.py to use the correct xcb file Issue arises from pyqt5 finding xcb dependency within the cv2 folder instead of its own pyqt5 folder. My old bandaid fix involved renaming /home/screwsorter/.local/lib/python3.9/site-packages/cv2/qt/plugins/platforms to platforms_old But that prevented usage of cv.imshow(). This new fix means we can use both cv2.imshow() and our pyqt5 application GUI. https://stackoverflow.com/questions/68417682/qt-and-opencv-app-not-working-in-virtual-environment opencv/opencv-python#736
I used pycharm to connect to a remote server and wanted to visualize it locally qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/usr/local/lib/python3.8/dist-packages/cv2/qt/plugins" even though it was found. Available platform plugins are: xcb. |
I ran into this issue. I'm commenting here because unlike the others, this one is open. I'm actually fine with the incompatibility, I think the instructions on how to fix it are clear. What I really would like to see, is a detection of what's going on and a proper, pythonic error when I'm doing stuff with python. What I'm seeing right now is no python error trace, no line number, etc. I'm just getting:
Meaning, I had to manually search for the line and function that causes this. |
Many people found the Opencv-python of version > 4.4.x conflicts with PyQt5,such as #386, #404 and #427 ,the solutions of this problem are
1, choose low version of opencv-python( I choose opencv-python 4.1.2.30 to solve this problem)
2, choose opencv-python-headless
However, if I have to use opencv-python 4.6.x, and must include image display UI(that means opencv-python-headless isn't proper for the project), is there any elegant solution?
The text was updated successfully, but these errors were encountered: