Local Conda and VS Code Setup
Local Conda and VS Code Setup
This guide walks you through installing Miniconda and Visual Studio Code on your own computer, creating a dedicated Conda environment, installing packages inside it, and running Python from that environment in VS Code.
By the end you should be able to:
- Open a terminal and confirm that
condaworks. - Create and activate a named Conda environment.
- Install packages into that environment only (not into the whole computer).
- Select that environment as the Python interpreter in VS Code and run a small script.
If terminal commands feel unfamiliar, skim the Linux Sysadmin Basics post first. For broader coding habits and why environments matter, see the Coding Practices Guidelines. Once you need Conda on the cluster rather than on your laptop, continue with Using Agustina.
1. Open a terminal
Use the native terminal for your operating system. Run the commands one line at a time, and wait for each one to finish before starting the next.
Windows
Very important: these Windows steps are for native Windows PowerShell. Do not use a WSL (Ubuntu) terminal for this guide.
- Open the Windows Search bar.
- Search for
Windows PowerShell. - Open it.
Continue with the Windows instructions in section 2.
macOS
- Open Spotlight search (or look under Applications → Utilities).
- Type
Terminaland open it.
Continue with the macOS instructions in section 2.
Linux
Very important: these Linux steps are for a normal Linux machine. Do not use a WSL (Ubuntu) terminal inside Windows for this guide.
- Open Activities (or press
Ctrl + Alt + Ton many distributions). - Search for
Terminaland open it.
Continue with the Linux instructions in section 2.
2. Install Miniconda
Miniconda is a small installer for Conda. Conda manages Python versions and packages in separate environments so projects do not interfere with each other.
- Open the official install overview: Installing Miniconda.
- Choose the guide that matches your operating system and preferred method:
- Windows beginners: prefer the Windows graphical installer (point-and-click).
- Windows command line: use the Windows shell installer only if you are comfortable in PowerShell or Command Prompt.
-
macOS beginners: prefer the macOS graphical (
.pkg) installer. - macOS / Linux terminal: use the terminal installer guide for your OS.
- Follow all of the steps on that page for your choice. Do not stop after the first download command. Run each suggested command carefully, line by line.
- When the installer asks whether to initialize Conda for your shell, choose yes (or leave the equivalent box checked).
When the install finishes, close the terminal and open a new one. Then check that Conda is available:
conda --version
You should see a version number. If the command is not found, reopen the terminal once more. On Windows, prefer the Anaconda Prompt application after install if PowerShell still cannot find conda.
Windows tip: download path access denied
If you use the Windows shell installer and PowerShell fails with an error like:
Invoke-WebRequest : Access to the path 'C:\windows\system32\Miniconda3-latest-Windows-x86_64.exe' is denied.
that usually means the download tried to write into a protected folder. Fix it by moving to your home directory first:
cd $HOME
Then rerun the download and install commands from the official Windows shell installer page, starting again from the download step. If this feels stressful, switch to the Windows graphical installer instead.
3. Install Visual Studio Code
3.1. Download VS Code
Download and install Visual Studio Code from the official site: https://code.visualstudio.com/Download.
Choose the installer that matches your operating system and accept the default options unless you have a reason not to.
3.2. Install useful extensions
- Open Visual Studio Code.
- Click the Extensions icon in the left sidebar (four squares).
-
Search for and install each of these extensions:
-
Python(published by Microsoft) JupyterPython IndentRainbow CSVPrettier - Code formatter
-
The Python extension is the essential one for selecting a Conda environment and running scripts. The others are helpful defaults for notebooks, indentation, CSV files, and formatting.
4. Create a simple project folder
Before creating environments, make a short, simple folder for your work.
- Create a folder called
Project(or another short English name) on your computer. - Keep the full path short and simple.
Very important path rules (these avoid many beginner failures later):
- Do not put the folder inside OneDrive or another cloud-synced folder.
- Do not bury it under a very long chain of directories.
- Prefer unaccented English letters (
A–Z,a–z), numbers, and underscores_in folder names. Avoid accents, spaces, and punctuation when you can.
Good examples:
- Windows:
C:\Users\jv\Desktop\Project - macOS / Linux:
~/Projector~/Desktop/Project
Open that folder in VS Code with File → Open Folder….
5. Create and use a Conda environment
A Conda environment is an isolated workspace with its own Python and packages. Create one environment per project (or per course) instead of installing everything into base.
5.1. Open the right terminal
-
Windows: after installing Miniconda, open Anaconda Prompt (recommended) or a new PowerShell window where
conda --versionalready works. - macOS / Linux: open a normal terminal as in section 1.
5.2. Go to your project folder
Use cd to enter the folder you created. Examples:
# Windows (Anaconda Prompt or PowerShell)
cd C:\Users\jv\Desktop\Project
# macOS / Linux
cd ~/Project
Your prompt should show that you are inside that folder. If you are unsure, check the current directory:
# Windows PowerShell
pwd
# Windows Anaconda Prompt (cmd): prints the current folder
cd
# macOS / Linux
pwd
You can also simply look at the path shown in the prompt.
5.3. Create the environment
Create a new environment named myenv with Python 3.11 (any supported recent Python 3.x is fine; keep the name short):
conda create -n myenv python=3.11 -y
Activate it:
conda activate myenv
Your prompt should now start with (myenv). That prefix means later python and pip commands use this environment, not the system Python.
Check which Python you are using:
python --version
which python
On Windows Anaconda Prompt / PowerShell, use:
python --version
where python
5.4. Install packages inside the environment
With (myenv) still active, install packages into this environment only.
With Conda (preferred when a package is available on conda channels):
conda install numpy pandas -y
With pip (useful when a package is mainly distributed on PyPI):
python -m pip install requests
Using python -m pip is safer than bare pip, because it installs into the same Python that python currently points to.
List what is installed:
conda list
Deactivate when you are done:
conda deactivate
To return to the project later:
conda activate myenv
6. Run Python from this environment in VS Code
- Open your
Projectfolder in VS Code if it is not already open. - Open the Command Palette:
- Windows / Linux:
Ctrl + Shift + P - macOS:
Cmd + Shift + P
- Windows / Linux:
- Type
Python: Select Interpreterand choose that command. - Pick the interpreter that shows
myenv(or the environment name you chose).
If you do not see it yet:
- Make sure you created and activated the environment successfully in a terminal.
- Click the refresh icon in the interpreter list, or reload the VS Code window.
- On Windows, restart VS Code after installing Miniconda if the list is empty.
Create a small test file named hello.py in the project folder:
import sys
print("Hello from", sys.executable)
Run it in VS Code with the play button, or from a VS Code terminal after activating the environment:
conda activate myenv
python hello.py
The printed path should point inside your Conda environment, not to a system-wide Python. That is the check that you are running inside the delimited environment.
You can also open a notebook (.ipynb) and choose the same myenv kernel in the kernel picker.
7. What to do next
You now have a local workflow: terminal → Conda environment → packages → VS Code interpreter → run Python.
Suggested next steps:
- Follow a short Conda tutorial to practice creating environments, exporting them, and understanding channels: Introduction to Conda for Data Scientists.
- Read the reproducibility section in the Coding Practices Guidelines, then continue with the linked Python learning resources there.
- When you move work to the cluster, use Using Agustina for module-based Conda, storage paths, and job helpers such as
subconda.sh. - If shell navigation still feels shaky, revisit Linux Sysadmin Basics.
Keep one habit from day one: activate the correct environment before installing packages or running project code. If the prompt does not show (myenv), pause and activate first.