Visual Studio Code

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]-anaconda
  • mamba/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.