Connect Spyder IDE to a remote kernel on Mistral

I am just describing spontaneously what worked for me to connect my local Spyder instance to a remote node on Mistral THAT YOU CAN CONNECT TO VIA SSH FROM YOUR LOCAL MACHINE!!!!

This is just a draft tutorial that will be updated/optimized afterwards.

Warning

  • If you have ssh issues on your side, this post is not for you

  • Some users experienced issues on Mac and Windows. Unfortunately, these are client-specific and not related to Mistral

  • If you have a workaround, you can share it with other users

Requirements

  • did you read Spyder documentation?

  • did you follow the steps described here?

  • do you know that you have to create the json configuration file?

This is what worked for me

Note

I tried these steps on my local Ubuntu 20 laptop and mistralpp4 (random) as the remote machine. It can work on other nodes (partitions) but I didn’t test it yet. Please, note that most of the issue are on the user side, for Spyder-specific issues check their [troubleshooting guide](https://docs.spyder-ide.org/current/first-steps.html).

Log-in (ssh) to mistralpp and get ip address

  1. ssh <username>@mistralpp.dkrz.de

  2. curl ifconfig.me

you need the ip addr!

Activate your conda env and start the kernel

Note

Better to have spyder installed (spyder-kernels) on your conda env on Mistral. Check their documentation.

  1. module load python3/unstable

  2. source activate <your env>

  3. python -m spyder_kernels.console --ip=<ip_addr_of_the_node>

This will generate a kernel-xxxx.json in .local/share/jupyter/runtime/ THAT YOU NEED TO COPY IT TO YOUR LOCAL MACHINE!!! with scp for example.

Configure your local Spyder instance

This step is similar to the one described here? These are the parameters:

image0

That’s all!

Troubleshootings

  • I assume that the Spyder remote concept is based on this. In case you are not able to connect to the remote kernel, you can use that tutorial for debugging.

References

[1] How to connect your Spyder IDE to an external ipython kernel with SSH PuTTY tunnel

[2] Connecting Spyder IDE to a remote IPython kernel

[3] Official Spyder IDE step-by-step