A way to solve "Could not load the Qt platform plugin "xcb" in xxxx" in MMagic. #1884
zhongqiu1245
started this conversation in
General
Replies: 1 comment
-
My env:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to add this solution into BUG Report, but when I fix this problem, I found this is not mmagic fault, it should blame PyQt and opencv (lol)
I found this ERROR when I played demo(after I installed mmagic successfully):
I thought it might be the way I installed at first (
pip install -v -e .
). But it was OK.Then I thought it might be the Qt's thing (according to the ERROR message). I tried everything I found, such as uninstall-install, version matching, pip-install/conda-install, but it didn't work.
Unfortunately, this ERROR would spread to other mmcodes which rely on PyQt and opencv, for examlpe, mmseg. My mmseg didn't work after this error came out.
After debugging painfully, I found opencv was the real troublemaker.
Here is the solution, please follow this step by step:
(Make sure you PyQt is installed by
pip install
. If you install it byconda install
, please uninstall it and pip install it)Step 1: install your mmagic successfully(
pip install -v -e .
orpip install mmagic
or something else)Step 2: pip uninstall or conda uninstall everything about opencv. In my env, I had
opencv-python
,opecv-python-headless
andopencv-contrib-python
, I uninstalled them all.Step 3: choose you version of opencv (for example, opencv-python==4.5.4.60. Don't choose the latest version)
Step 4: pip install the opencv things. BUT follow this order:
Make sure your versions of opencv things are in same. for example:
AND, the most important thing, do not mess this order.
Step 5: Done
The reason why this error appear is the compatibility between opencv and PyQt is not very well. And it bug still not be fixed in the latest version, both of them.
I hope this report can help other people. If the authors of mmagic are interest this, you can add this into doc.
My English is not very well. If I write something wrong, please point it out. I can improve my English in this way (smiling face). Thank you in advance.
Beta Was this translation helpful? Give feedback.
All reactions