Could not load the Qt platform plugin (while dockerizing the application)
Asked Answered
D

1

6

I have built a face detection app using opencv and transfer learning model (resnetSSD). Output of application : video will open and model will be able to recognize the faces.

Application is running perfectly in my local system .. Able to build the docker also , but when running the docker container below error i am getting:

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/usr/local/lib/python3.6/dist-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.

please suggest how i can fix this ??

Decalcomania answered 21/5, 2021 at 8:34 Comment(1)
I has the same problem without docker - but I don't remeber what I made to solve it. I'm not sure if I reinstalled cv2 or I installed newer PyQt5 or helped to install PyQt6Immethodical
L
0

To show images from inside Docker container you should run it like below:

docker run -it \
   -e DISPLAY=$DISPLAY \                # <--- here
   -v /tmp/.X11-unix:/tmp/.X11-unix \   # <--- Here
# everyting else

After making sure cv2 is properly installed in docker image you may wish to run

xhost +local:root

on the host machine (assuming it's a local experiment).

Linolinocut answered 20/10, 2021 at 16:33 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.