Setup
Examples
All code in this course is in Python.
Packages
We use the following packages, listed here with the week in which they first appear.
| Package | For |
|---|---|
numpy |
arrays and linear algebra |
pandas |
data frames |
matplotlib |
plots |
scikit-learn |
machine learning methods |
scipy |
optimization, hierarchical clustering |
torch |
neural networks |
umap-learn |
nonlinear dimensionality reduction |
We recommend the uv package and project manager.
Installing uv
Follow the instructions at docs.astral.sh/uv/getting-started/installation, or run one of these:
# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"Setting up the environment
Create a project folder for the course, create a virtual environment with Python 3.12, and install the packages into it.
mkdir bio322 && cd bio322
uv venv --python 3.12
uv pip install numpy pandas matplotlib scikit-learn scipy torch umap-learn jupyterOn Linux/macOS activate it with source .venv/bin/activate, on Windows with .venv\Scripts\activate. Once activated, python and jupyter point to this environment. (With VS Code, see below, you usually don’t need to activate it manually — VS Code finds .venv automatically.)
Editor
We recommend VS Code with the Python and Jupyter extensions installed (search for them in the Extensions panel, Ctrl+Shift+X/Cmd+Shift+X). VS Code then runs both notebooks (.ipynb) and plain scripts (.py), selects the .venv you just created as the interpreter/kernel, and gives you a debugger.
If you prefer a notebook in the browser instead, use Jupyter directly (it was installed above with uv pip install ... jupyter):
jupyter labChecking that it works
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import sklearn
print(np.__version__, pd.__version__, sklearn.__version__)