Workspace Setup

Before we move to the next section, let’s make sure everyone has a working Python environment with the right packages installed.

Option B — Jupyter Notebooks (via uv)

Jupyter Notebooks are interactive documents that allow you to combine executable Python code, text, visuals, and equations in a single place. They run code in small, editable “cells,” making it easy to experiment, get immediate feedback, and document your reasoning as you go. This format is especially useful for learning and teaching machine learning, as it supports step‑by‑step exploration, visualisation of results, and clear explanations alongside the code.

There are several ways to install and run Jupyter Notebooks, ranging from full Python distributions like Anaconda to lightweight package managers and online platforms. For this course, we recommend using the uv package manager, as it provides a simple, reliable, and reproducible environment setup with minimal configuration.

What is a package manager?

A package manager is a tool that helps you install, update, and manage software libraries (called “packages”) for a programming language. For most python projects, uv will be a great choice of package manager.

Install uv

Package manager installation should only need to be done once on your computer. If you encounter any issues, see here for more installation methods to try.

Open your Command Prompt and run:

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Open Terminal and run:

curl -Ls https://astral.sh/uv/install.sh | bash

Open Terminal and run:

curl -Ls https://astral.sh/uv/install.sh | bash

After installation, check that uv is available by typing uv --version, then pressing enter. You may need to restart your terminal for the changes to take effect.

Move into Project Directory

To set up your Python environment, you need to be in your project directory. Follow these steps:

  1. Open your terminal.
  2. Create or navigate to your project directory.
Create a Virtual Environment

Enter the following command to create a minimal virtual environment:

uv init --bare

This will create a pyproject.toml file, which will record information on all of the packages you install in your virtual environment.

Install Packages

For all projects we need jupyterlab, this is where we edit code. This can be added to your project with this command:

uv add jupyterlab

For the Introduction to Data Analysis in Python course, you would need the pandas and seaborn package. You can add these with:

uv add pandas seaborn scikit-learn
Opening JupyterLab

Now you can open JupyterLab with:

uv run jupyter lab

This will take some time, and you will see text being printed in the terminal. Once JupyterLab is running, a browser window should pop open. This window should like similar to the image below.

JupyterLab Window
Create a Notebook

To create a notebook, click the “Notebook” icon in the JupyterLab launcher. The window should now look like this:

JupyterLab Notebook, with key features highlighted with arrows and blue boxes.

In each cell, python code can be entered. It can be run by clicking the “Run” button or by pressing Shift + Enter.