2

I am a python developer who is stuck on a windows machine that doesn't support all the necessary library versions that I need to use. Luckely I have access to a Linux box, which I normally open via putty. I am currently using spyder with anaconda for development.

My question:
Is it possible to "pipe" a python interpreter from my remote linux box into a windows code editor? In a REPL fashion, so that I can execute selections of code and instead of running them locally, pass them through to the remote interpreter? I have very good latency time (university). Happy to switch editors if somebody know how this can work.

Curlew
  • 109

3 Answers3

2

2 ideas

A) Not piping but if you use putty or whatever ssh client, so you access the python interpreter. if you run SAMBA on lnux, then linux will do windows file sharing, and then your windows code editor can view the remote files as if they are local. But you may want to make sure that the windows code editor doesn't go nuts if the connection breaks e.g. a cable comes out.

or

B)Another way might be dropbox. So the files are local on windows and synced with your linux machine, then your python interpreter which you run via putty and your windows code editor see the files locally

barlop
  • 25,198
1

You are "supposed" to be able to connect to a remote interpreter through Spyder from the Consoles>>Connect to an existing Kernal menu item. However I have not been able to get it to work.

https://groups.google.com/forum/#!topic/spyderlib/Ytd61nCkjBM

I'm hoping they get this worked out, as well as editing remote files. This is something most modern IDEs are starting to be able to do.

abalter
  • 766
1

Here is the new Spyder documentation for connecting to a remote kernel.

From the link:

Note, if on Windows and connecting to a remote machine over ssh, you’ll need to install the paramiko python package first (e.g. with conda install paramiko if using Anaconda).

To connect to an external kernel,

Launch an IPython kernel on the local or remote host if one is not already running.

If using Spyder 3.3.0 or later, you’ll need to do so with

python -m spyder_kernels.console 

(after you’ve first installed spyder-kernels on the host with install spyder-kernels). If using a version of Spyder before 3.3.0, ipython kernel should work to launch the kernel, albeit without certain Spyder-specific features.

Copy the connection file (jupyter/runtime/dir/path/kernel-pid.json) to the machine you’re running Spyder on (if remote) or note its location (if local).

You can get jupyter/runtime/dir/path by executing jupyter --runtime-dir in the same Python environment as the kernel.

Click Connect to an existing kernel from the Console menu or the IPython Console pane’s “Gear” menu.

Browse for or enter the path to the connection file from the previous step. If you’re connecting to a local kernel, click Ok and Spyder should connect to the kernel; if a remote kernel, proceed to the final step.

As a convenience, kernel ID numbers (e.g. 1234) entered in the connection file path field will be expanded to jupyter/runtime/dir/path/kernal-id.json on your local machine.

If connecting to a remote kernel over ssh, check the appropriate box and type the full hostname you’re connecting to (in the form username@hostname:port-number). Then, enter either username's password on the remote machine, or your user SSH keyfile (typically .perm) (only one is needed to connect), and press Ok.

The port number is the one on which the SSH daemon (sshd) is running, typically 22 unless you or your administrator has configured it otherwise.

Connect to kernel dialog, requesting path and connection details