Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pycharm Remote Python Interpreter over SSH Gateway, X11 forwarding

Tags:

python

pycharm

I want to configure PyCharm 3.0 to use a Remote Python Interpreter.

The Problem is, I have to connect over a SSH Gateway:

MyMachine -> Gateway -> Machine with Python

When I connect via Cygwin I type the following: ssh -t [email protected] "ssh [email protected]"

Is there a way to achieve this in PyCharm? Another question, can I forward the X11 server to PyCharm (so that I can view the matplotlib plots on my machine?)

Regards, m

like image 792
Maecky Avatar asked Sep 30 '13 11:09

Maecky


People also ask

Can PyCharm connect to remote server?

On the PyCharm welcome screen, select Remote Development. In the Run the IDE Remotely section, click SSH Connection. If you have the IDE already running on the remote server and you have a connection link, you can use the Connect to Remote Host With a Link section.

How do I fix the interpreter problem in PyCharm?

Change the Python interpreter in the project settings Press Ctrl+Alt+S to open the IDE settings and select Project <project name> | Python Interpreter. Expand the list of the available interpreters and click the Show All link. Select the target interpreter.


2 Answers

I was able to the piggyback X11 forwarding through another ssh connection. Try setting the DISPLAY environment variable in your PyCharm run configuration like so:

DISPLAY=localhost:102

Check the value of DISPLAY in the other connection to see exactly what the value should be.

like image 158
Lefunque Avatar answered Oct 19 '22 21:10

Lefunque


I am not sure I have understood your question correctly, it is maybe more adequate for the UNiX/Linux part.

At you machine:

ssh -fN -L 2222:machinewithPython:22 \  [email protected]

This connects port 2222 on your local machine to port 22 on remotemachine, and the ssh tunnnel will remain open until you kill the ssh process.

See the following links here and there.

like image 32
orubiop Avatar answered Oct 19 '22 22:10

orubiop