Set Up Python and VS Code for Data Science, Step by Step
Install Miniconda and Visual Studio Code, give each project its own clean environment, and run your first Jupyter notebook — with a screenshot for every click.
Before you can analyse data, clean a dataset or train a model, you need a Python setup that simply works. The good news: modern package managers have made this far less painful than it used to be. This guide walks you from an empty machine to a working notebook in four stages, with a screenshot at every step.
Here's the toolkit we'll put together:
- Miniconda installs Python and manages the packages each project needs.
- Visual Studio Code is the editor where you'll write and run your code.
- A conda environment gives each project its own isolated set of packages.
What we'll cover
- Install Miniconda
- Install VS Code and its Python extension
- Create a dedicated environment for your project
- Run a notebook to confirm everything works
1. Install Miniconda
Step 1.1: Head to the Miniconda download page and pick the installer for your operating system. Choose one that ships with Python 3.8 or newer, and match your system type (64-bit for almost every modern computer).
Miniconda is the slimmed-down sibling of Anaconda: it bundles conda, Python and a few core tools like pip, and leaves the rest up to you.

Step 1.2: Open the downloaded installer. On the welcome screen, click Next >.

Step 1.3: Read through the licence and click I Agree.

Step 1.4: When asked who the installation is for, choose Just Me (the right choice on a personal computer) and continue.

Step 1.5: Choose where Miniconda should live. The suggested folder is fine as long as the drive has free space.

Step 1.6: On the advanced options screen, tick both boxes:
- Add Miniconda3 to my PATH — so your terminal can find Python and conda from anywhere.
- Register Miniconda3 as my default Python — so other programs, VS Code included, pick it up automatically. Each project can still use a different Python version later.

Step 1.7: Click Install and let it run. It usually takes a minute or two.

Step 1.8: Once the screen reads Installation Complete, click Next >.

On the last screen you can untick the two optional links to tutorials, then click Finish.

2. Install VS Code
Step 2.1: Grab the installer from the VS Code download page. The screenshots here show Windows (64-bit), but the steps on macOS and Linux are nearly identical.

Step 2.2: Run the installer, accept the licence, and click Next >.

Step 2.3: Confirm the install folder; the default is usually best.

Step 2.4: The installer offers to add a Start Menu shortcut. Leave it as is and click Next >.

Step 2.5: Tick the extra options shown below. A desktop icon is handy, and adding VS Code to PATH lets you open any folder in it straight from a terminal.

Step 2.6: Review the summary of your choices and click Install.


Step 2.7: When setup finishes, click Finish to open VS Code for the first time.

You'll be greeted by the welcome screen:

Step 2.8: Out of the box, VS Code doesn't know much about Python. Microsoft's free Python extension fixes that, adding smart code completion (Pylance), error checking, debugging, formatting, a variable explorer and more.
- Open the Extensions view: the icon of four small squares in the left sidebar.
- Search for Python (this needs an internet connection).
- Pick the one published by Microsoft.
- Click Install.

Once installed, the extension page looks like this:

Step 2.9: Now let's see which Python VS Code can find. Switch back to the Explorer (the top icon in the sidebar), then:
- Press Ctrl+Shift+P to open the Command Palette — a search box for every command and setting in VS Code. You'll use it a lot.
- Type Select Interpreter and choose Python: Select Interpreter.

After a moment, VS Code lists every Python it found. Right now there's just one: the base Python 3.9.7 that came with Miniconda. You could start coding with it straight away, but there's a better habit to build first.

3. Create a project environment
Step 3.1: From the Start menu, open Anaconda Prompt (miniconda3).

Notice (base) at the start of the line. That tells you which environment is currently active.

Step 3.2: Create a new environment with this command, swapping in a name of your choice. The python= part pins the Python version, which doesn't have to match base:
conda create --name yourenvname python=3.8For this guide, we'll call it datascience:
conda create --name datascience python=3.8
Conda shows the packages it's about to install. Type y, press Enter, and give it a moment.

To check it worked, list your environments:
conda env listYou should now see two: base and datascience.

Step 3.3: Switch into the new environment:
conda activate datascienceThe prompt changes from (base) to (datascience). Anything you install now goes into this environment only.

Step 3.4: Time to add some tools. Every package installs the same way:
conda install library_nameFirst, ipykernel. It's what lets VS Code run Jupyter notebooks with this environment:
conda install ipykernel
Then the everyday data-science essentials: pandas for working with tables, and matplotlib, seaborn and plotly for charts:
conda install pandas
conda install matplotlib
conda install seaborn
conda install plotly
Step 3.5: Back in VS Code, open the Command Palette (Ctrl+Shift+P) and run Select Interpreter again.

This time the list includes your new environment. Choose Python 3.8.11 (datascience: conda) so this project uses it.

4. Run your first notebook
Step 4.1: Open the Command Palette (Ctrl+Shift+P), type New Jupyter Notebook and select it. A blank notebook opens with a single empty cell.

Step 4.2: Run two quick checks:
- Type
1 + 1in the cell and run it, either with the ▶ button beside the cell or with Ctrl+Enter. Seeing2means Python is running. - Add a cell below with Ctrl+Shift+B and import one of the packages you installed:
import pandas as pdNo error? Then the notebook is using your datascience environment, packages and all.

That's it — you have a clean, project-ready Python setup.
Found this useful? Pass it on to a friend or labmate who's just getting started with Python.