Can't use vscode remote connection with cv2.imshow() : qt.qpa.screen: QXcbConnection: Could not connect to ... Could not connect to any X display

Viewed 28

I'm using vscode to connect to a server and I want to display an image with cv2.imshow() from openCV, but I get the following error:

qt.qpa.screen: QXcbConnection: Could not connect to display localhost:13.0
Could not connect to any X display.

I get the following warning when connecting via ssh:

Warning: No xauth data; using fake authentication data for X11 forwarding.

as suggested in many posts about the topic, I added the following lines to /etc/ssh/ssh_config on my mac:

Host *
    ForwardX11Trusted yes
    ForwardAgend yes
    ForwardX11 yes
    XAuthLocation /opt/X11/bin/xauth

on the server: touch ~/.Xauthority xauth add :0 . mcookie

and added the DISPLAY env variable:

export $DISPLAY=localhost:0

I know that is possible to save each image cv2.imwrite(), but in my case I'm doing some complex debugging and I cannot save every single image. I really need to do it this way.

I'm using macOS Monterrey 12.5.1

Any suggestions on what else to try? Thanks for your help!! :)

0 Answers
Related