This lesson is in the early stages of development (Alpha version)

Introduction to Machine Learning with Scikit Learn: Setup

Setup

Please complete the setup at least a day in advance of the workshop. If you run into issues, contact the workshop organizers by email so you’re ready to begin on time. The setup steps include:

  1. Set up the workshop folder
  2. Install Python 3.11.9
  3. Install uv and set up the virtual environment

1. Set up the workshop folder

Create a folder on your desktop called ML_workshop for storing the workshop data and environment.

cd ~/Desktop
mkdir ML_workshop
cd ML_workshop
pwd
~/Desktop/ML_workshop

2. Install Python 3.11.9

We recommend using Python 3.11.9 to ensure consistency across participants.

Download the appropriate installer from the official 3.11.9 downloads page. Follow your OS-specific installation steps.

3. Install uv and set up the environment

uv is a modern, fast Python package and environment manager. It’s significantly faster than pip and simplifies reproducible setup.

Step-by-step instructions:

A. Install uv

pip install uv

B. Create a requirements.txt file in the ML_workshop folder:

numpy 
pandas 
matplotlib 
opencv-python 
scikit-learn 
jupyterlab 
seaborn

C. Set up the virtual environment:

We’ll specify that we want to use python 3.11.9.

uv venv --python=3.11.9

This creates a folder named .venv/ in your ML_workshop directory.
Inside this folder, you’ll find many subfolders and files—that’s expected! Here’s what they do:

  • bin/ (or Scripts/ on Windows): contains the Python interpreter and executable scripts
  • lib/: stores all installed Python packages (and their dependencies)
  • pyvenv.cfg: tracks Python version and configuration
  • include/: headers used to build native extensions

These components form an isolated environment, keeping your installed packages separate from your global Python setup.

D. Activate environment

Some installation environments may require a preliminary activation step before we install our requirements.

Run one of the OS-specific commands below just to be safe.

# Mac/Linux
source .venv/bin/activate

# Git Bash on Windows
source .venv/Scripts/activate

# Windows CMD (not recommended)
.venv\Scripts\activate.bat

E. Install requirements.txt

Install the libraries specified in requirements.txt.

uv pip install -r requirements.txt

F. Add the environment to Jupyter Lab:

Run one of the OS-specific commands below. This allows us to select our new environment from Jupyter without having to activate it beforehand.

# Mac/Linux
.venv/bin/python -m ipykernel install --user --name=.venv --display-name "ML_workshop"

# Git Bash on Windows
.venv/Scripts/python.exe -m ipykernel install --user --name=.venv --display-name "ML_workshop"

# Windows CMD (not recommended)
.venv\Scripts\python.exe -m ipykernel install --user --name=.venv --display-name "ML_workshop"

G. Launch Jupyter Lab:

jupyter lab

When Jupyter opens, select the ML_workshop kernel from the dropdown.