I don't know if you're still looking for an answer to this, but for future people arriving here, and for my own reference:
Yes, you can. You have to create an ssh-tunnel and connect Spyder to the kernel via localhost. For you that would look something like this:
ssh -L 3336:me@jumpbox:22 me@remote
22
is for the port your ssh server at remote is listening to. This is usually 22, unless the moderator changed this. 3336
is the port at localhost to connect to, you can choose any number you like above 1024 (which are privileged ports).
Then proceed as explained in the Spyder docs, i.e., launch the spider kernel (in the environment you want) on remote
python -m spyder_kernels.console
copy the connection file (kernel-pid.json
) file to your local computer:
scp -oProxyJump=me@jumpbox remote:/path/to/json-file/kernel-pid.json ~/Desktop
/path/to/json-file
you have to change to the path to the connection file (which you can find by running jupyter --runtime-dir
on remote
in the same environment as the spyder-kernel is running) and kernel-pid.json
of course to the real file name. ~/Desktop
copies it to your Desktop-folder, you can change that to wherever you want.
Connect Spyder to the kernel via "Connect to existing kernel", point it to the connection file you just copied, check the This is a remote kernel (via SSH) box and enter localhost
as the Hostname, and 3336
as the port (or whichever port you changed it to).
That should do it.
Note, that, as is the case for me, your jumpbox
server may break your ssh connection over which you launched the Spyder kernel, which will cause your kernel to break. So you might want to use
python -m spyder_kernels.console &
to have it run in the background, or launch it in a screen
session. However, note that you cannot shutdown a remote kernel with exit, and it will keep running (see here), so you have to kill it in a different way.