'qt.qpa.plugin: Could not find the Qt platform plugin "wayland"
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)
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.
Solution 1:[1]
I encountered a very similar error when trying to start OBS Studio 27.1.3 on Arch Linux running Sway as the window manager. OBS produced this error:
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
This bug report indicated that I was missing the dependency qt5-wayland which I fixed by installing it:
pacman -S qt5-wayland
Afterwards, OBS ran just fine and it was able to record the screen and audio.
Solution 2:[2]
I ran into the same problem when trying to launch KeepassXC 2.6.6 with Wayland:
QT_QPA_PLATFORM=wayland keepassxc
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
The solution on Ubuntu 21.10 and 22.04 was to install qtwayland5:
sudo apt install qtwayland5
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | morhook |
