VSCode and Remote SSH

For VS code we use the Remote-SSH extension.

Install the Remote-SSH extension in VS Code.

Got to settings in VS Code, then under extensions, enable this setting: remote.SSH.showLoginTerminal, tick the box. The box should look like this:

VSCode Remote

This enables to pull up the terminal so that sign in via 2FA that way.

Then create or the ssh config file

vim ~/.ssh/config

Enter edit mode by pressing i.

paste:

Host icelake
    User bb667
    HostName login-icelake.hpc.cam.ac.uk
    ControlMaster auto
    ControlPath ~/.ssh/%r@%h:%p

Save and exit by pressing Esc, then :wq, then Enter.

Note: you can also do this edit of the config file within VSCode.

Jupyter kernel

To make your Python virtual environment visible on your remote VSCode follow this. You need to activate your python environment and also set the jupyter kernel coresponding to your environment. You can set the jupyter kernel to your environment by running:

python -m ipykernel install --user --name=<venv-name> --display-name "<venv-name>"

where you should replace <venv-name> with the name of your virtual environment.

Run this command once you have activated your virtual environment with source <venv-name>/bin/activate.

You will certainly need to install `ipykernel’ to run this command. Just do:

pip install ipykernel

You will also certainly need to install the Jupyter and Python extensions for your remote VSCode session. You will probably be prompted about it.