Visual Studio Code¶
VS Code can connect to a compute node on the cluster via SSH, giving you a full remote development environment with terminal, file browser, and extensions.
Looking for a simpler setup?
If you don't want to install anything locally, check out code-server: a full VS Code environment that runs entirely in your browser.
Do not run VS Code on login nodes
VS Code runs background processes that consume significant CPU and memory. Running it on a login node will degrade the cluster for all users and your session may be terminated. Always connect to a compute node through a SLURM allocation.
Prerequisites¶
- VS Code installed on your local machine
- The Remote - SSH extension installed in VS Code
- SSH key authentication configured for the cluster (see connecting to the cluster)
Step 1: Request a compute node¶
Submit a job that starts a private SSH server on a compute node:
#!/bin/bash
#SBATCH --qos=regular
#SBATCH --job-name=vscode
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=4
#SBATCH --mem=16G
#SBATCH --time=08:00:00
#SBATCH --output=/scratch/%u/vscode-%j.out
#SBATCH --error=/scratch/%u/vscode-%j.err
module load DIPC-Utils/0.0.2
ssh-server-start.sh
Atlas clusters
On Atlas FDR and Atlas EDR, add the -a flag: ssh-server-start.sh -a
Submit with sbatch vscode.slurm, then check the output file once the job starts:
cat /scratch/$USER/vscode-<JOBID>.out
You will see something like:
==============================================================
Custom SSH Server Started
==============================================================
Hostname: hyperion-260
Port: 11332
==============================================================
To securely connect to the custom SSH server, set up SSH tunneling:
1. Run the following command on your local machine:
ssh -L <local-port>:hyperion-260:11332 <username>@hyperion.sw.ehu.es -N
2. Connect your SSH client to 'localhost:<local-port>'.
==============================================================
Note the hostname and port: you need them for the next step.
Step 2: Create an SSH tunnel¶
On your local machine, open a terminal and create a tunnel using the hostname and port from the job output:
ssh -L 2222:COMPUTE_NODE:PORT USERNAME@hyperion.sw.ehu.es -N
Replace COMPUTE_NODE, PORT, and USERNAME with your actual values. For example:
ssh -L 2222:hyperion-260:11332 <username>@hyperion.sw.ehu.es -N
This maps your local port 2222 to the SSH server running on the compute node. If port 2222 is already in use locally, pick another one (e.g., 12222).
Info
You need to recreate this tunnel every time the SLURM job restarts (new node, new port).
Step 3: Configure and connect VS Code¶
Add an entry to ~/.ssh/config on your local machine:
Host hyperion-tunnel
HostName localhost
Port 2222
User USERNAME
Replace USERNAME with your cluster username, and Port with the local port you chose in step 2.
Then in VS Code:
-
Open the Remote Explorer panel. The
hyperion-tunnelentry should appear.
-
Click to connect. VS Code will install its server component on the compute node (first time only).
-
Browse to your project directory on the cluster and start working.
Using Jupyter notebooks¶
VS Code can run Jupyter notebooks directly on the compute node.
-
Install the Jupyter and Python extensions on the remote VS Code instance (they install on the cluster, not locally).
-
Open a terminal inside VS Code and load the Miniforge3 module:
module load Miniforge3 -
Open your
.ipynbfile. If VS Code asks you to select a kernel, click Select Another Kernel:
-
Choose Python Environments, then select the base conda environment (the one provided by
module load Miniforge3):
Warning
Do not select the "recommended" kernel, as it may point to the system Python which lacks scientific packages.
-
Your notebook should now execute on the compute node:

Julia notebooks¶
-
Install the Jupyter and Julia extensions on the remote instance.
-
Load the Julia module in the VS Code terminal:
module load Julia -
If the Julia extension cannot find the binary, set
julia.executablePathin the extension settings:
-
If you use a custom Julia environment (created with
Pkg), activate it from the Julia extension panel:
Troubleshooting¶
VS Code cannot connect after the tunnel is up
Verify that the SLURM job is still running (squeue -u $USER). If the job ended, the SSH server is gone and you need to submit a new one.
Port already in use locally
Change the local port in both the ssh -L command and your ~/.ssh/config.
Modules not available in VS Code terminal
VS Code opens a non-login shell, so .bash_profile is not sourced. Add your module load commands to ~/.bashrc, or run them manually in the VS Code terminal each session.
ssh-server-start.sh fails
As a fallback, request an interactive allocation and tunnel to the node's standard SSH port (22):
srun --nodes=1 --ntasks=1 --cpus-per-task=4 --mem=16G --qos=regular --time=8:00:00 --pty bash
Then create the tunnel to port 22 of the allocated node:
ssh -L 2222:COMPUTE_NODE:22 USERNAME@hyperion.sw.ehu.es -N
See also¶
-
code-server (VS Code in browser)
Run VS Code in the browser without any local installation.
-
Jupyter Notebook
Run Jupyter notebooks on compute nodes via SSH tunnel.
-
VNC sessions
Remote desktop for GUI applications.