Setup
Examples
All code in this course is in Python.
Packages
We use the following packages.
| Package | For |
|---|---|
numpy |
arrays and linear algebra |
pandas |
data frames |
matplotlib |
plots |
scikit-learn |
machine learning methods |
scipy |
optimization and other numerical routines |
torch |
automatic differentiation and model fitting |
umap-learn |
visualizing high-dimensional data |
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 jupyter
source .venv/bin/activate # Linux/macOS
.venv\Scripts\activate # WindowsEditor
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__)