Provides access to a Visual Studio Code web interface.
Activating a Python virtual environment
Currently supported distributions for using conda/virtual enviornments in VS Code are:
python3.[9,10,11]-anacondamamba/py3.[10,11,12]
Activating virtual environments created from standard python distributions ($ module load python) may work only If they are activated prior to launching VS Code. To achieve that, you may utilize the "source setup script" option.
Create the setup script file:
Open a terminal and run:
vim setup.sh
Add the following lines (assuming your virtual environment is called venv):
#!/bin/bash module load python source venv/bin/activate
Save and close, and set execute permissions (optional):
chmod +x setup.sh
When launching your VS Code session, in the "Source this setup file" provide the absolute path to your setup script. For example:
/home/<uniquename>/setup.sh
Installing extensions
Visual Studio code Open OnDemand application executes through a compute node which requires that a proxy be correctly configured in order to allow access to external networks, such as through the internet. When downloading VS Code extensions through the marketplace (marketplace.visualstudio.com) this requires setting up the following proxy variable (/etc/profile.d/http_proxy.sh)
To automate this setup, you can append the following line to your ~/.bashrc file, and then launch your VS Code application.
echo -e 'source /etc/profile.d/http_proxy.sh' >> ~/.bashrc
Alternatively, a setup script that sources the http_proxy.sh script may also be used, following the methods described above for Python.
Connecting to Great Lakes Compute Nodes via Local VS Code (SSH)
This guide explains how to connect your local VS Code installation directly to Great Lakes compute nodes using SSH with a jump host configuration. This allows you to work on compute nodes with the full power of your local VS Code setup.
Prerequisites:
- An active Great Lakes account
- VS Code installed on your local machine
- Remote - SSH extension installed in VS Code
- An active job running on a compute node
1Generate SSH Keys (If You Don't Have One)
SSH keys allow you to authenticate securely without typing your password every time.
On macOS/Linux:
- Open Terminal
Run the following command:
ssh-keygen -t ed25519 -b 4096- When prompted for a file location, press Enter to accept the default (
~/.ssh/id_ed25519) - Optionally, enter a passphrase for added security (or press Enter for no passphrase)
- Your keys will be generated:
- Private key:
~/.ssh/id_ed25519 - Public key:
~/.ssh/id_ed25519.pub
- Private key:
On Windows:
- Open PowerShell or Command Prompt
Run the following command:
ssh-keygen -t ed25519 -b 4096- When prompted for a file location, press Enter to accept the default (
C:\Users\<YourUsername>\.ssh\id_ed25519) - Optionally, enter a passphrase for added security (or press Enter for no passphrase)
- Your keys will be generated:
- Private key:
C:\Users\<YourUsername>\.ssh\id_ed25519 - Public key:
C:\Users\<YourUsername>\.ssh\id_ed25519.pub
- Private key:
2Copy Your Public Key
You need to copy the contents of your public key file to add it to Great Lakes.
On macOS/Linux:
cat ~/.ssh/id_ed25519.pubThis will display your public key. Select and copy the entire output (starts with ssh-ed25519 ...).
On Windows (PowerShell):
type C:\Users\<YourUsername>\.ssh\id_ed25519.pubOr using Command Prompt:
type %USERPROFILE%\.ssh\id_ed25519.pubSelect and copy the entire output (starts with ssh-ed25519 ...).
3Add Your Public Key to Great Lakes
Login to Great Lakes from your terminal:
ssh <umich-uniquename>@greatlakes.arc-ts.umich.eduEdit the authorized_keys file:
nano ~/.ssh/authorized_keysOr if you prefer
vi:vi ~/.ssh/authorized_keys- Paste your public key (from Step 2) on a new line at the end of the file
- Save and exit:
- In
nano: PressCtrl+O(to save), thenEnter, thenCtrl+X(to exit) - In
vi: PressEsc, type:wq, then pressEnter
- In
Set correct permissions (important for security):
chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keysLogout from Great Lakes:
exit
4Configure SSH Jump Host on Your Local Machine
Now you'll configure your local SSH to use the login node as a "jump host" to reach compute nodes.
On macOS/Linux:
Open or create the SSH config file:
nano ~/.ssh/configAdd the following configuration:
Host gl-login HostName greatlakes.arc-ts.umich.edu User <umich-uniquename> Host gl-compute HostName <YOUR_COMPUTE_NODE> User <umich-uniqname> ProxyJump gl-login- Replace
<YOUR_COMPUTE_NODE>with your actual compute node (e.g.,gl3000,gl3001, etc.) - Save and exit: Press
Ctrl+O,Enter, thenCtrl+X
On Windows:
Open PowerShell and create/edit the SSH config file:
notepad C:\Users\<YourUsername>\.ssh\configIf the file doesn't exist, Notepad will ask if you want to create it. Click Yes.
Add the following configuration:
Host gl-login HostName greatlakes.arc-ts.umich.edu User <umich-uniqname> Host gl-compute HostName <YOUR_COMPUTE_NODE> User <umich-uniqname> ProxyJump gl-login- Replace
<YOUR_COMPUTE_NODE>with your actual compute node (e.g.,gl3000,gl3001, etc.) - Save and close Notepad
5Start an Interactive Job on Great Lakes
Login to Great Lakes:
ssh <umich-uniqname>@greatlakes.arc-ts.umich.eduStart an interactive job on a specific node:
salloc --account=<your_account> --partition=standard --nodes=1 --ntasks-per-node=1 --mem=4GB --time=04:00:00- Note the compute node name from the output (e.g.,
gl3000,gl3155, etc.) - Update your SSH config (from Step 4) with this compute node name if you haven't already
- Keep this session active (don't close the terminal) while you use VS Code
6Connect VS Code to the Compute Node
- Open VS Code on your local machine
- Open the Command Palette: Press
Ctrl+Shift+P(Windows/Linux) orCmd+Shift+P(macOS) - Select:
Remote-SSH: Connect to Host... - Choose:
gl-compute(the host you configured in Step 4) - VS Code will connect through the login node to your compute node
- Open your project folder on the compute node and start coding!
Troubleshooting SSH Connection
| Issue | Solution |
|---|---|
| Permission Denied | • Ensure your public key is correctly added to ~/.ssh/authorized_keys on Great Lakes• Check file permissions: chmod 600 ~/.ssh/authorized_keys |
| Connection Timeout | • Ensure you have an active job running on the compute node • Verify the compute node name in your SSH config matches your job's node • In VS Code, search for remote.SSH.connectTimeout and increase timeout value to a larger integer |
| VS Code Can't Find Config | • macOS/Linux: ~/.ssh/config• Windows: C:\Users\<YourUsername>\.ssh\config |
| Proxy Jump Not Working | • Test manually: ssh gl-compute• If it works but VS Code doesn't, try reloading VS Code |
| Remote SSH 2FA - Unable to acces terminal to enter 2FA option | You can also modify your SSH connection settings to handle 2FA:
This way, all prompts (password, 2FA, etc.) will appear in a proper terminal window where you can type. |
