Managing scode Environments
This guide covers everything you need to create, switch between, and manage scode environments. These are lightweight, isolated workspaces stored in ~/.scode/envs/, containing your VS Code Server extensions, user data, and cached assets.
1 What is an scode environment?
An scode environment is a directory at ~/.scode/envs/<quality>/<name>/ that contains:
- an
extensions/folder for VS Code Server extensions - a
data/folder for user settings and server logs
You can think of it as the VS Code equivalent of a Conda environment: create as many as you like, each with its own extensions and settings.
In the environment path:
<quality>is eitherstableorinsiders(currently,scodeonly support thestableversion of VS Code).<name>is the name for the scode environment, when you run a scode command that require a workingscodeenvironment (e.g.,scode serveorscode ext), a default environment with the namedefaultwill be automatically created and activated.
The default environment should be sufficient for most use cases. Custom environments, however, can help isolate extension sets. They are ideal for troubleshooting conflicts or separating projects by programming languages.
2 Creating your first scode environment
# Create an custom `scode` env and have it activated globally
scode create myenv
scode activate myenv
# Install extensions into the activated environment
scode ext install ms-python.python ms-toolsai.jupyter
# Launch VS Code Server using that env
scode serve-web -- --account <pi-account> --time 01:00:00
scode create <env_name>initializes a new environment under~/.scode/envs/stable/<env_name>/.scode activate <env_name>sets it as the global default (persisted in~/.scode/env-stable).scode ext install …installs the specified extensions to the activated environment.scode serve-webwill launch the server with the extensions and user settings from the activated environment.
3 Command reference
3.1 scode create
- Usage:
scode create <env_name> - Purpose: Create a fresh
scodeenvironment. -
Behavior:
- Directory
~/.scode/envs/stable/<env_name>/is created (quality defaults to stable). - No VS Code binaries are installed yet. That happens lazily on first
serve-web. - Errors out if
<env_name>already exists.
- Directory
3.2 scode activate
- Usage:
scode activate <env_name> - Purpose: Activate and use an
scodeenv globally. -
Behavior:
- A plaintext file
~/.scode/env-<quality>stores the environment selection. - Subsequent
scodecommands inherit this env unless an explicit--envoverrides it.
- A plaintext file
3.3 scode list
- Usage:
scode list -
Output example:
Local stable channel environments: myenv * defaultAn asterick
*indicates the currently active environment.
3.4 scode remove
- Usage:
scode remove <env_name> - Purpose: Removes an
scodeenv with all associated extensions and user data - Behavior:
- Recursively deletes the env directory.
- If an active environment is removed, the next available environment will be activated automatically.
4 Using environments with serve-web
Both of the following examples starts a VS Code server with the myenv scode environment.
-
Inline: pass
--env <name>every timescode serve-web --env myenv -- --time 02:00:00 --account <pi-account> -
Activate: permanently sets an environment as global default
scode activate myenv scode serve-web -- --time 02:00:00 --account <pi-account>
Tip
If you omit both --env and activate, scode falls back to the implicit default environment (created and activated on first use).
5 Versioning and Compatibility
5.1 Environment Isolation
Each scode environment is fully isolated. This means:
- Extensions, settings, and user data installed in one environment do not affect any other.
- All content lives under
~/.scode/envs/<quality>/<name>/, keeping environments self-contained and reproducible.
5.2 VS Code Version Decoupling
scode environments are not bound to specific versions of VS Code. You can serve any environment with any supported VS Code version using:
scode serve-web --version <vscode_version> -- --account <pi-account>
scode periodically downloads new VS Code builds into $SCODE_ARCHIVE_DIR. When you launch an environment, it locates the specified version from this archive, extracts it to ~/.scode/versions/<quality>/<vscode_version>, and serves it from there.
By default, the --version argument for scode serve-web is set to latest. This means scode will automatically pull and use the most recent VS Code version from the archive. This is the recommended behavior for most users.
To view all VS Code versions currently available on the Midway cluster:
scode download --versions
This version decoupling gives you the flexibility to:
- Easily opt in or out of the latest VS Code versions.
- Test your environment across multiple editor versions.
- Ensure long-term reproducibility by explicitly pinning a specific VS Code version.
5.3 Extension Compatibility
While environments and VS Code versions are decoupled, extensions are typically tightly coupled to the VS Code version they were built for. Refer to the Extensions documentation for best practices.
7 Troubleshooting
-
Extensions missing after installation?
Always verify that you're working in the correct environment by running
scode list. Use the--envoption to explicitly target a specific environment when installing extensions or serving VS Code. If you have created or switched to a new environment, you must re-install your extensions there. -
Disk quota exceeded in
$HOME?This often occurs when too many environments or cached tarballs accumulate. Remove unused environments to free up space.
Alternatively, you can move the
~/.scodedirectory to/scratchand create a symbolic link back to your home directory:mv ~/.scode /scratch/midway3/$USER/.scode ln -s /scratch/midway3/$USER/.scode ~/.scodeThis approach helps keep your home directory within quota limits.