Can we develop in a Pycharm interface in our computer while running it with the computational resources and environment in another remote PC

Can we develop in a Pycharm interface in our computer while using the computational resources and environment in another remote PC?

For example in Jupyter Notebook, we can execute the following command inside the remote PC:

jupyter notebook --ip 135.2.55.205 --port 8888

Which allows us to access the notebook with that ip-address remotely from any other computer and after doing so, the codes we we write remotely in the notebook would use the CPU or GPU of the that remote PC. So when I use the debugging feature of PyCharm or simply run the code, I would like the computation to be carried out in the remote PC similar to using the above Jupyter Notebook with that ip address.

Can we do the same with PyCharm? I know in PyCharm we can for example define a remote virtual-environment, but I guess that would still use our own computational power rather than a remote machine.

A similar approach would probably be if I just do remote-desktop to the remote PC, but that won't be very convenient.

4 comments
Comment actions Permalink

Regarding Jupyter, you can connect PyCharm to the remote Jupyter server similarly how you connect your web browser to it.

If you're talking about general python development and your remote host is Linux, you can use SSH interpreter: https://www.jetbrains.com/help/pycharm/configuring-remote-interpreters-via-ssh.html#

Or you can run the whole IDE remotely with X11 forwarding, although this scenario is issue-prone and discouraged.

1
Comment actions Permalink

Yes, using SSH interpreter allow you to develop locally, but the actual execution of the script is done on the remote machine.

More info on SSH: https://www.jetbrains.com/help/pycharm/configuring-remote-interpreters-via-ssh.html#

More info about configuring Jupyter server: https://www.jetbrains.com/help/pycharm/configuring-jupyter-notebook.html#configure-server

 

Regarding separate GUI - yes, it is possible to run the code remotely via SSH interpreter, while external UI's generated by your python code will be displayed on your local machine via X11 forwarding. But if you're using matplotlib, PyCharm can show plots inside it's own UI, so no forwarding is needed: https://www.jetbrains.com/help/pycharm/matplotlib-support.html#console

1
Comment actions Permalink

Andrey Resler Thank you for reply. Does your second suggestion (configuring remote interpreter via ssh) allows the computation to be carried out in the remote machine also? or will the computation happen in our machine.

 

I guess connecting pycharm to a remote Jupyter notbook may do what I want that is develop in my machine while the computation is in the other machine. Could you also mention a link that might be useful for this? I have found some but I'm not sure if they are regarding your suggestion. Thank you.

 

What I wonder though also is that sometimes running the Pycharm opens new GUI windows, that I hope will work in any of the cases from above. Maybe my Pycharm could be connected to the jupyter server but the other GUIs that open from running the code could use X11 forwarding.

0
Comment actions Permalink

Andrey Resler

Thanks again, I just tried the ssh/sftp for having the remote interpreter only that now I get "cannot connect to X server". Somehow the X11 forwarding is not active, but I don't know yet how I activate it through PyCharm. 

Would there be any advantage between configuring jupyter notebook server and using the remote ssh interpreter?

My code uses physics simulators like PyBullet and Mujoco, X11 forwarding I think will use my own graphics card to bring up their GUIs which is ok for me now but It would have been also good if there was no graphics card needed on my own machine. 

0

Please sign in to leave a comment.