Working with Jupyter notebooks on gadi/ARE via VS Code

Is this possible? Can we have listed here the steps needed to do that?

1 Like

Hi @navidcy,

It is possible to connect to an ARE session via VSCode (and then use any VSCode extension, for example Jupyter and Python extension to work with .ipynb files similarly to what you would do in a jupyterlab session).

To do so you will have to install the “Remote - SSH” extension (or the whole “Remote Development” pack). To install the remote-ssh extension from your command line you can type code --install-extension ms-vscode-remote.remote-ssh.
A complete guide on how to install, set up, and use the extension can be found here.

My suggestion, is to add a section in your ~/.ssh/config file that looks like this:

Host are
       ProxyJump <your-gadi-username>@gadi.nci.org.au
       User <your-gadi-username>
       ForwardX11 true
       ForwardX11Trusted yes
       Hostname <cpu-node-hostname>

You can get the <cpu-node-hostname> from the ARE sessions once you connect. It shows up within the Host field as shown in the snapshot below, and it is usually in the format “gadi-cpu-bdw-00X”.

Once you change your hostname in the “are” section of your ~/.ssh/config file (thing that you have to do every time you connect to a different ARE session), you can connect to “are” using VSCode’s “Remote-SSH Connect to Host” command from the Command Palette (F1 or ⇧⌘P).

For a helpful guide on how to use jupyter notbook with VSCode’s Python and Jupyter extensions you can check this youtube video → Jupyter Notebooks in VS Code Extension NEW in 2022 - Tutorial Introducing Kernels, Markdown, & Cells - YouTube

Cheers
Davide

4 Likes

cc @ashjbarnes

Hey @atteggiani, do you know how to choose different kernel in VS Code?

Also, it seems that my VS Code connects to hh5 modules although I launch an ARE session on xp65. What should I change in VS Code?

Hi @polinash,

You can choose between the available kernels at the top right of your interactive window (where now it says analysis3-23.04 (Python 3.9.17).
If the desired kernel doesn’t show up, you can:

  1. Click on Select Another KernelPython Environments and check if the desired Python environment is among the detected ones. If there is, click on it.

  2. If there isn’t, you can open the Command Palette (F1 or ⇧⌘P) and type “select interpreter”, then click on Python: Select InterpreterEnter interpreter path… Then enter the path to the desired Python environment and click enter (alternatively you can browse the system to find the desired Python environment).

  3. Once completed point 1 or 2, if you open a new interactive session (open command palette → Jupyter: Create Interactive Window) the kernel should be available among those in the top-right menu.

Please let me know if you still have problems selecting your kernel.

Cheers
Davide