I wanna create a docker image on windows and image base [in docker file] for docker image would be linux os. My program uses the open-cv program which its output image has to be shown with CV2.imshow()
. but after running container, I get this error.
please help to fix it.
qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/usr/local/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.
2
Answers
I had this same issue and none of the solutions I looked up solved the issue for me. I even used
xhost +
and imshow still did not work.I was using the image tensorflow/tensorflow:2.7.0-gpu as my base image for my project. Seems like the package
libsm6
is missing for some reason, and doingapt install libsm6
made it work.Hope this helped!
I also had this issue. The one solution that finally worked was to install an earlier version of opencv-python. The version I had originally installed was 4.6.0.66. I uninstalled opencv
pip uninstall opencv-python
in docker and reinstalledRUN pip install opencv-python==4.1.2.30
in the dockerfile.