x11 Forwarding while debugging

Answered

I want to use x11 forwarding for debugging when using a remote interpreter. The problem arises when I want to plot an image with matplotlib. Even though the code gets executed without an error, no image is displayed. 

>plt.imshow(x)
<matplotlib.image.AxesImage at 0x7feefe256cf8>
>plt.show()

Note:

I have been using a workaround by making an external ssh connection and setting the DISPLAY variable in pycharm manually. But it has stopped working since a recent update. 

5 comments

Hi Udaranga, could you please specify PyCharm version you are using? Do you have Settings | Tools | Python Scientific | Show plots in tool window option enabled?

0

Hi Pavel,
Pycharm version is 2017.3.3 and I had Show plots in tool window option enabled. Once I disabled it, the old workaround started working. When the interpreter is local plots get displayed in the tool window. But when I'm using the remote interpreter, it doesn't work. 

0

Could you please try 2018.1 version? x11 forwarding was fixed with PY-27511.

0

I downloaded the 2018.1.4 and tried the solution you have suggested. Now it gives the error 
"RuntimeError: Invalid DISPLAY variable" when I execute plt.imshow(x) in the debugging window, 

I have set the value of DISPLAY variable to 'localhost:10.0' as suggested in the answer. 

0

The suggestion with DISPLAY from PY-27511 is for Python console only, if you run the script you have to edit the corresponding Run Configuration by adding DISPLAY=localhost:10.0 to it.

Meanwhile, it should really work without manual configuration, could you please specify your host OS?

0

Please sign in to leave a comment.