Home > Enterprise >  qt.qpa.plugin: Could not find the Qt platform plugin "wayland"
qt.qpa.plugin: Could not find the Qt platform plugin "wayland"

Time:11-19

I'm trying to run through some image recognition tutorials, but I keep running into this error that's preventing me from proceeding. I'm running Ubuntu 21.10, and python 3.9.7. My code is as such.

import cv2
img=cv2.imread("path",1)
#print(type(img))
#print(img)
#print(img.shape)
#print(img.ndim)
cv2.imshow("Moon",img)
cv2.waitKey(2000)

though more importantly, this is the error I get.

qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in "/home/peepo/.local/lib/python3.9/site-packages/cv2/qt/plugins"

I went to the folder in the path and sure enough, wayland isn't there. I've been searching around for a while now and installed several different things from solutions to people experiencing similar things I've found on the web. Nothing has worked. Currently I'm at the point where I'm looking to see if there's some manual download somewhere that I can just drag and drop into the folder. I've read that there are some issues with the new version of ubuntu and qt4, so I'm not sure if this is more of an ubuntu or python problem. Any help would be appreciated.

CodePudding user response:

I got the same issue after upgrading to Ubuntu 21.10 (from 20.10).

Installing an older version of OpenCV worked for me.

pip install opencv-python==4.3.0.38
  • Related