Python plotting on remote server using PyCharm
<p>I have started to learn Python and so far my setup has been following - Python 3.5 installation on Win10 64bit local machine with PyCharm as a great IDE. Everything works, matplotlib charts and other visual outputs display fine, debugging works, etc.</p>

<p>Now, I have came across some libraries which works only on Linux. I have set up Ubuntu 16.4 64bit VPS on Digital Ocean, installed Python 3.5. In PyCharm I have set up SFTP connection to remote host. Code running works, debugging works, however, I am not able to bring display output (matplotlib plots,...) to local (Win10) machine. As I am not at all familiar with Linux GUI environments (X11?), after googling I have following questions: </p>

<p>1) Should anything be installed on remote Linux machine? (e.g. x11 client/server/smth?)</p>

<p>2) Should anything be installed on local Win machine? (e.g. Xming?)</p>

<p>3) Should anything be configured on remote Linx machine? (e.g. X11 forwarding)</p>

<p>4) Should anything be configured on local Win machine PyCharm?</p>

<p>5) There are X11 forwarding settings in Putty and some have suggested to use those but I am not sure, should Putty session run in paraller with PyCharm and can that be avoided. </p>

<p>Thanks a lot! </p>

<p>PS - I have installed Jupyter Notebook (and latest Jupyter Lab) on remote machine and it works excellent, however I am still prefering PyCharm as primary IDE with better code completion, debugger and other perks.</p>

<p>Ok, after some more googling I finally managed to get this process working, hope it helps somebody: </p>

<p>1) on remote host (VPS, Ubuntu 16.04) I had to install X11 server, which I did by: </p>

<pre><code>sudo apt-get install xorg
sudo apt-get install openbox
</code></pre>

<p>2) On remote host I had to make sure that X11Forwarding is enabled in /etc/ssh/sshd_config</p>

<p>3) On local Win10 machine I had to install Xming server and launch it with default settings.</p>

<p>4) On local Win10 machine I had to configure Putty to use X11 forwarding (Connection-> SSH -> X11 Forwarding) with default settings and keep connection open while running PyCharm (it seems there is no option in PyCharm to enable x11 forwarding, so putty must be running in the background)</p>

<p>5) On remote machine I had to check Display number (echo $DISPLAY) - this can be different for everyone. For me it was localhost:10.0</p>

<p>6) In PyCharm Run configuration -> Environment variables I had to add DISPLAY=localhost:10.0</p>

<p>After all these steps and Putty+Xming running in backgroud, I was able to execute remote code and bring graphic back to my Windows 10 PC!</p>

<p>PS - process is actually slow, I have to wait around 10 seconds before image is brought back to me. I am not sure why or how to speed it up. Might be another question. (reducing chipher strength and enabling compression does not help. It seems some sort of initialization problem with x11 remote and local)</p>

python linux windows matplotlib x11