(Part 4 of series Blueprint for a Modern Research Computing Environment)
Follow me :
This article installs VS Code, connects it to your Ubuntu environment (via Remote WSL on Windows, or natively on Linux), and wires up the Python and Jupyter extensions. You’ll then select env_project1 as your interpreter and kernel, and run both first_script.py and your notebook from Part 3 directly inside VS Code — one place for terminal, Git, debugger, scripts, and notebooks.
In Part 3, we ran Python code in both a .py script and a .ipynb notebook using JupyterLab. In this part, we’ll set up VS Code — a single environment where you can work with both file types, alongside your terminal, Git, and debugger.
By the end, you’ll have:
env_project1 connected as your interpreter and kernelfirst_script.py and your notebook directly inside VS CodeAI tools (like Claude, Grok, Gemini, or ChatGPT) give the best troubleshooting advice when they have the exact text of the tutorial. To ensure the AI understands what you are trying to build, we will give it the actual file.
1. Download the tutorial file
2. Upload it to your AI
Part4.md into the chat).3. Ask for Help Copy and paste this exact prompt into the chat along with your file:
I have attached the markdown file for the tutorial I am following. Please read it so you understand the specific environment I am trying to build.
I need help with the following:
Step [X]: [paste exact step text from the blog]
Command I ran: [paste exact command]
What happened: [paste full output/error — if the terminal was truly blank, say so explicitly]
Please help me troubleshoot and fix this error. You can use your general knowledge to solve the problem, but your solution MUST align with the architecture and tools taught in the attached file. Do not suggest alternative setups that contradict the tutorial. Once fixed, tell me what to do next in the article.
To go deeper on a step before you run a command:
I have attached the
Part4.mdfile. Look at Step [X] and explain exactly what the command does and why we are doing it before I run it.
Think of this series as the roadmap and your AI assistant as your learning companion.
~/project_1 with env_project1, first_script.py, and a .ipynb notebook (Part 3)Go to https://code.visualstudio.com/ and click Download for Windows.
Run the downloaded file — it will be named something like VSCodeUserSetup-x64-1.xx.x.exe.
The installer will walk you through these screens:
code . in the terminal to open VS Code from any folderNow open your Ubuntu terminal and verify:
code --version
You should see a version number. If you get command not found, close the terminal completely, reopen it, and try again.
Open your terminal and run these commands one by one:
sudo apt update
sudo apt install wget gpg
wget -qO- [https://packages.microsoft.com/keys/microsoft.asc](https://packages.microsoft.com/keys/microsoft.asc) | gpg --dearmor > packages.microsoft.gpg
sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] [https://packages.microsoft.com/repos/code](https://packages.microsoft.com/repos/code) stable main" | sudo tee /etc/apt/sources.list.d/vscode.list > /dev/null
sudo apt update
sudo apt install code
Verify:
code --version
You should see a version number printed.
Windows (WSL) users only. Native Linux users skip to Step 3.
The Remote WSL extension allows VS Code running on Windows to connect to your Ubuntu environment. Without it, VS Code won’t see your Linux files, Conda environments, or packages.
Ctrl+Shift+X to open the Extensions panelOpen VS Code. Press Ctrl+Shift+X to open the Extensions panel.
Search for and install these two extensions:
These give VS Code the ability to:
.py scripts with a selected Conda interpreter.ipynb notebooks with a selected Conda kernelActivate your environment and navigate to your project folder in the terminal:
conda activate env_project1
cd ~/project_1
Open VS Code from the terminal:
code .
WSL users: VS Code will open on Windows and automatically connect to your Ubuntu environment via the Remote WSL extension. You’ll see a green indicator in the bottom-left corner of VS Code showing WSL: Ubuntu.
Native Linux users: VS Code opens locally with ~/project_1 as the workspace.
From this point, everything is identical for both.
.py FilesVS Code needs to know which Python environment to use when running .py files.
Ctrl+Shift+P to open the Command PaletteVS Code will now use env_project1 when running any .py file in this project.
first_script.pyIn the VS Code file browser on the left, click on first_script.py to open it.
To run it:
Ctrl+F5, orThe output will appear in the Terminal panel at the bottom:
Array: [1 2 3 4 5]
Mean: 3.0
Sum: 15
Same output as Part 3 — but now running directly inside VS Code.
.ipynb FilesIn the VS Code file browser on the left, click on your .ipynb notebook to open it.
In the top-right corner of the notebook, you’ll see a kernel selector showing either a kernel name or Select Kernel. Click it.
A dropdown will appear at the top of the screen. Select Python (env_project1).
This connects your notebook to the same Conda environment you’ve been working in.
With your notebook open and env_project1 selected as the kernel, you’ll see the same cells you wrote in Part 3.
Key notebook controls in VS Code:
| Action | How |
|---|---|
| Run a cell | Shift+Enter or click ▷ next to the cell |
| Run all cells | Click Run All in the top toolbar |
| Clear output of a cell | Right-click the cell → Clear Cell Output |
| Clear all outputs | Click Clear All Outputs in the top toolbar |
| Restart kernel | Click Restart in the top toolbar |
| Restart and run all | Click Restart → Restart and Run All Cells |
Run your notebook. Expected output in the first cell:
Array: [1 2 3 4 5]
Mean: 3.0
Sum: 15
Same result as Part 3 — the environment, the code, and the output are identical. The difference is you now have your terminal, file browser, Git, and debugger all in the same window.
What You’ve Done:
~/project_1 in VS Code from the terminalenv_project1 as your interpreter and kernelfirst_script.py and your notebook inside VS CodeNext: Part 5 — Linux Essentials for HPC and Remote Servers | Previous: Part 3 — Managing Projects with Conda Environments