skip to Main Content

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


  1. 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 doing apt install libsm6 made it work.

    Hope this helped!

    Login or Signup to reply.
  2. 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 reinstalled RUN pip install opencv-python==4.1.2.30 in the dockerfile.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search