I am using vscode remote ssh and connect to my server (a node in a cluster) via ssh. My local machine is Windows and my Host is ubuntu. My vscode is being used to code in python.
I am trying for weeks to be able to run a python code and display images in the debug console like what we do in the normal terminal or in jupyter notebook, but I notice that I cannot display the image in the debug console at all. here is a toy example
import numpy as np
import matplotlib.pyplot as plt
img = np.random.rand(300,200)
plt.imshow(img);plt.show()
basically when I try to do plt.imshow(img);plt.show()
in the debug console I either get nothing or I get qt.qpa.screen: QXcbConnection: Could not connect to display localhost:0.0 Could not connect to any X display.
.
I tried several methods such as using x11 extenson or adding x11 forwarding in the putty or add Display in the launch.json
. However, none of them works.
I am coming to the conclusion that vscode remote ssh and debug console in python dont have that feature yet. But if you know a way to do it PLEASE let me know.
I hope that I am clear that displaying image in the normal situation is working and it is not working in the debug situation. Please note that when I am doing the debug I dont want to display the image out side of the debug console.
Thanks