FoundationPose icon indicating copy to clipboard operation
FoundationPose copied to clipboard

QT could not connect to display inside Docker container

Open Nikhil-Shenoy opened this issue 1 year ago • 4 comments

Hi, I've set up the docker container and am now trying to run the run_demo.py example, but I'm getting the following error:

qt.qpa.xcb: could not connect to display :0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/opt/conda/envs/my/lib/python3.8/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.

Aborted (core dumped)

I've tried setting export DISPLAY=0 and re-running, but I'm still getting the error about xcb not being loaded and the application getting aborted. What is the fix for this?

Nikhil-Shenoy avatar Apr 08 '24 22:04 Nikhil-Shenoy

Hi @Nikhil-Shenoy,

I assume you maybe are running on a remote machine without x11 forwarding, can you try running the demo with the debug argument set to 0 instead?

python run_demo.py --debug 0

Let me know if this helps.

savidini avatar Apr 09 '24 11:04 savidini

Yes, I'm on SSH'd on a remote system. I did set the flag as you showed, and the script does run to completion, but I don't get any result in the debug directory afterwards.

Nikhil-Shenoy avatar Apr 09 '24 13:04 Nikhil-Shenoy

Same problem here.

I quick fixed commenting lines 72-73 from run_demo.py

      # cv2.imshow('1', vis[...,::-1])
      # cv2.waitKey(1)

imerino95 avatar Apr 09 '24 14:04 imerino95

Hi @Nikhil-Shenoy,

if debug is set to 0, only the predicted poses will be saved in the ob_in_cam folder.

If you want images, do what @imerino95 has already mentioned. This will prevent the script from trying to create a window to show the predictions (same as like setting debug to 0). Now you can run the demo again with debug set to 2:

python run_demo.py --debug 2

This will save all visualization images to the track_vis folder, which you can then copy from the remote to your local machine.

savidini avatar Apr 09 '24 14:04 savidini

if you are using a headless server, you cannot visualize. Also see above answers.

wenbowen123 avatar Apr 10 '24 17:04 wenbowen123

Yes, disabling the imshows worked. Thanks!

Nikhil-Shenoy avatar Apr 11 '24 20:04 Nikhil-Shenoy