You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Could not find the Qt platform plugin "wayland" in opencv path #729
Write here how did you expect the library to function.
Actual behaviour
Write here what went wrong.
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 "/home/firefly/venv/lib/python3.9/site-packages/cv2/qt/plugins"
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: xcb.
Aborted (core dumped)
Steps to reproduce
example code
import cv2
cap=cv2.VideoCapture(8)
while True:
ret,frame =cap.read()
frame=cv2.flip(frame,1)
cv2.imshow('frame',frame)
if cv2.waitKey(1)&0xff==ord('q'):
break
cap.release()
cv2.destroyAllWindows()
This is not a generic OpenCV usage question (looking for help for coding, other usage questions, homework etc.)
I have read the README of this repository and understand that this repository provides only an automated build toolchain for OpenCV Python packages (there is no actual OpenCV code here)
The issue is related to the build scripts in this repository, to the pre-built binaries or is a feature request (such as "please enable this additional dependency")
changed the title [-]ould not find the Qt platform plugin "wayland" in opencv path[/-][+]Could not find the Qt platform plugin "wayland" in opencv path[/+]on Sep 12, 2022
I have the same problem for opencv-python 4.5.x,4.6.x, the error message is
Connected to pydev debugger (build 201.8538.36)
QObject::moveToThread: Current thread (0x55ae47946190) is not the object's thread (0x55ae4795d6b0).
Cannot move to target thread (0x55ae47946190)
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/hitbuyi/.conda/envs/py1121/lib/python3.9/site-packages/cv2/qt/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: xcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl.
My environments are
OS: ubuntu20.04
Conda: 4.43
python: 3.9
opencv-python: 4.5.x,4.6.x
Guys the error shows but it still works. It shows like some kind of warning and it does not prevent my program from running. But when I use ffpyplayer to also read audio the error shows but this time it will not allow my program to run further.
Please what is the cause of this strange behavior?
I tested out your provided wheel opencv_contrib_python-4.7.0.3564733-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl with wayland enabled environment and pyqt 5.15.8 installed on Ubuntu 22.04 and can confirm the same output as I now found on your PR #784. Hope this still helps.
qt.qpa.wayland: Failed to load client buffer integration: "wayland-egl"
qt.qpa.wayland: Available client buffer integrations: ()
qt.qpa.wayland: No shell integration named "xdg-shell" found
qt.qpa.wayland: No shell integration named "xdg-shell-v6" found
qt.qpa.wayland: No shell integration named "wl-shell" found
qt.qpa.wayland: No shell integration named "ivi-shell" found
qt.qpa.wayland: Loading shell integration failed.
qt.qpa.wayland: Attempted to load the following shells ("xdg-shell", "xdg-shell-v6", "wl-shell", "ivi-shell")
edit: I can also confirm that the wheel you built works nicely when I change the session to X11.
Reacted by Alexander Smorkalov and Ole Jørgen Brønner
A workaround I found was to use xwayland-run which spawns an xwayland instance for opencv to run in. I did it with QT_QPA_PLATFORM=xcb xwayland-run -- pipenv run python ... where pipenv installed opencv-python, opencv-contrib-python, and opencv-python-headless into a virtual environment
@mahyarmirrashed yes it is. So there 3 ways I 've proven to work to suppress this message:
use os.environ.pop("QT_QPA_PLATFORM_PLUGIN_PATH") after import cv2
try sudo pip install opencv-python-headless
delete the libqxcb frm OpenCV in /home/yourname/.local/lib/python3.9/site-packages/cv2/qt/plugins/platforms
In the Thonny IDE commen in no. 1 works fine should in terminal too.
The problem is that opencv-python does not come with a library for Wayland so QT_QPA_PLATFORM_PLUGIN_PATH has no value and does not point to any location.
Therefore, your method does not solve the problem on systems operating based on Wayland such as Raspberry Pi-5.
@mahyarmirrashed yes it is. So there 3 ways I 've proven to work to suppress this message:是的,它是。所以我已经证明有三种方法可以有效地抑制这种信息:
use os.environ.pop("QT_QPA_PLATFORM_PLUGIN_PATH") after import cv2 使用后
try 试一试sudo pip install opencv-python-headless
delete the libqxcb frm OpenCV in /home/yourname/.local/lib/python3.9/site-packages/cv2/qt/plugins/platforms从OpenCV中删除libqxcb
In the Thonny IDE commen in no. 1 works fine should in terminal too.在tony IDE的评论中没有。我也应该在终端工作。
The problem is that opencv-python does not come with a library for Wayland so QT_QPA_PLATFORM_PLUGIN_PATH has no value and does not point to any location.问题是opencv-python没有为Wayland提供库,所以QT_QPA_PLATFORM_PLUGIN_PATH没有值,也不指向任何位置。
Therefore, your method does not solve the problem on systems operating based on Wayland such as Raspberry Pi-5.因此,您的方法不能解决基于Wayland操作的系统(如Raspberry Pi-5)上的问题。
The deeper cause lies in the Dockerfile build operation, which ignored the Wayland build "-skip qtwayland"更深层次的原因在于Dockerfile的构建操作,它忽略了Wayland的构建“-skip qtwayland”
I agree with you. How did you solve it in the end?
Hi to all, Im using ubuntu OS 64 with VSCode, I have created a folder in which a create a virtualenv to run code. Im trying to use cv2 to refresh images, and got this warning: qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in "/home/gaston/esp32_projects/gpio_test/python_rgb/.venv/lib/python3.12/site-packages/cv2/qt/plugins"
and th eprogram just stop working. I have tried to install Qt5 in the venv, tried to install opencv-python-headless but the problem persist. I tried to install pywayland using pip install but got the same error. How to solve it?
how do I solve this in the virtualenv? Im using VSCode in this venv and I already tried to install python headless, set envirnoment variables in the activate script, before start the venv.
Im still gettin gthis error: qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in "/home/gaston/esp32_projects/gpio_test/python_rgb/.venv/lib/python3.12/site-packages/cv2/qt/plugins"
I'm not sure then. If you want to undo the changes to your system that was applied through the command I gave previously, you can remove export QT_QPA_PLATFORM=xcb from the file ~/.bashrc
Activity
[-]ould not find the Qt platform plugin "wayland" in opencv path[/-][+]Could not find the Qt platform plugin "wayland" in opencv path[/+]KaranParekh11 commentedon Sep 29, 2022
i also have same problem with latest version of opencv-python.If any one was able to solve this issue please reply here.
hitbuyi commentedon Oct 10, 2022
I have the same problem for opencv-python 4.5.x,4.6.x, the error message is
My environments are
OS: ubuntu20.04
Conda: 4.43
python: 3.9
opencv-python: 4.5.x,4.6.x
Any progress in this issue?
likehengqq commentedon Oct 17, 2022
You can try lowering the Python version.
bengabp commentedon Oct 31, 2022
Hello guys,please I need help about this. I am getting same error here also and its not allowing video stream to continue.
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in "/home/bengab/venv/lib/python3.10/site-packages/cv2/qt/plugins@likehengqq I have also tried decreasing the opencv-python version but its still not working.
bengabp commentedon Nov 1, 2022
Guys the error shows but it still works. It shows like some kind of warning and it does not prevent my program from running. But when I use ffpyplayer to also read audio the error shows but this time it will not allow my program to run further.
Please what is the cause of this strange behavior?
asmorkalov commentedon Nov 17, 2022
OpenCV distributes own instance of QT to facilitate imshow and some other UI functions. Own QT built is done without wayland support: https://github.com/opencv/opencv-python/blob/4.x/docker/manylinux2014/Dockerfile_x86_64#L59. I'll take a look if we can add this option to the package for the next release.
Viha123 commentedon Jan 21, 2023
yep similar issue here were you able to figure it out?
asmorkalov commentedon Jan 24, 2023
Related: https://stackoverflow.com/questions/68417682/qt-and-opencv-app-not-working-in-virtual-environment
asmorkalov commentedon Jan 26, 2023
@likehengqq @bengabp @KaranParekh11 Could you try to install experimental package with Qr 5.15.8 and Wayland plugin enabled for build: https://github.com/opencv/opencv-python/actions/runs/4012888768? I need feedback from real Wayland-based system.
asmorkalov commentedon Feb 3, 2023
#784
vineoak commentedon Feb 16, 2023
I tested out your provided wheel
opencv_contrib_python-4.7.0.3564733-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whlwith wayland enabled environment and pyqt 5.15.8 installed on Ubuntu 22.04 and can confirm the same output as I now found on your PR #784. Hope this still helps.edit: I can also confirm that the wheel you built works nicely when I change the session to X11.
11 remaining items
mak448a commentedon Dec 20, 2023
It works!
golfinq commentedon Jan 1, 2024
A workaround I found was to use
xwayland-runwhich spawns an xwayland instance for opencv to run in. I did it withQT_QPA_PLATFORM=xcb xwayland-run -- pipenv run python ...where pipenv installedopencv-python,opencv-contrib-python, andopencv-python-headlessinto a virtual environmentAvasam commentedon Jan 6, 2024
Could be related, if not the exact same issue, since the problem is with bundled QT: https://bugreports.qt.io/browse/QTBUG-114635
EnziinSystem commentedon May 18, 2024
The problem is that opencv-python does not come with a library for Wayland so QT_QPA_PLATFORM_PLUGIN_PATH has no value and does not point to any location.
Therefore, your method does not solve the problem on systems operating based on Wayland such as Raspberry Pi-5.
There is no Wayland library.
The deeper cause lies in the Dockerfile build operation, which ignored the Wayland build "-skip qtwayland"
cccmmmhhh commentedon Oct 4, 2024
I agree with you. How did you solve it in the end?
sebbean commentedon Oct 22, 2024
@golfinq
how do i find this command? I have wayland running, but i cant seem to find this binary or package
#729 (comment)
GastonMelo commentedon Nov 6, 2024
Hi to all, Im using ubuntu OS 64 with VSCode, I have created a folder in which a create a virtualenv to run code. Im trying to use cv2 to refresh images, and got this warning:
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in "/home/gaston/esp32_projects/gpio_test/python_rgb/.venv/lib/python3.12/site-packages/cv2/qt/plugins"and th eprogram just stop working. I have tried to install Qt5 in the venv, tried to install opencv-python-headless but the problem persist. I tried to install pywayland using pip install but got the same error. How to solve it?
mak448a commentedon Nov 6, 2024
Did you try #729 (comment)?
Also, @sebbean, try installing it with
GastonMelo commentedon Nov 6, 2024
how do I solve this in the virtualenv? Im using VSCode in this venv and I already tried to install python headless, set envirnoment variables in the activate script, before start the venv.
mak448a commentedon Nov 6, 2024
Did you try
echo "export QT_QPA_PLATFORM=xcb" >> ~/.bashrcand then installing normal opencv?GastonMelo commentedon Nov 6, 2024
Im still gettin gthis error:
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in "/home/gaston/esp32_projects/gpio_test/python_rgb/.venv/lib/python3.12/site-packages/cv2/qt/plugins"inside that folder I got only this: libqxcb.so
mak448a commentedon Nov 7, 2024
I'm not sure then. If you want to undo the changes to your system that was applied through the command I gave previously, you can remove
export QT_QPA_PLATFORM=xcbfrom the file~/.bashrcAn-Gabhar1 commentedon Nov 9, 2024
(Ubuntu 22.04)
I did and the result is:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package xwayland-run
golfinq commentedon Nov 9, 2024
xwayland-runis a script utility found here: https://gitlab.freedesktop.org/ofourdan/xwayland-runJayAitchh commentedon May 23, 2025
Hello, none of the suggested issues work in a virtual environment, at least for me. Anyone found a solution for that?