安装Setup guide
Get Python, Jupyter, DuckDB, and the companion notebooks running before week 1. About 30 minutes.
You need a working Python environment before week 1. Every notebook and lab in Semester 1 runs on the same set of packages. Chapter 6 explains the stack. This page gets it installed.
What you need
- A computer running Windows, macOS, or Linux, with at least 8 GB of memory.
- About 2 GB of free disk space.
- Python 3.10 or later.
- Git, to download the notebooks. You can download a zip from GitHub instead.
No computer you can install on? Use Google Colab. It runs in the browser.
Option 1: uv (recommended)
uv installs Python and the packages in one tool. It's fast, and it keeps the course packages separate from anything else on your machine.
- Install uv by following the official instructions.
- Download the notebooks and install the packages:
git clone https://github.com/arkane-dev/book-companion-notebooks.git
cd book-companion-notebooks
uv venv --python 3.12
uv pip install -r requirements.txt- Start Jupyter:
uv run jupyter labOption 2: pip and venv
If you already have Python 3.10 or later:
git clone https://github.com/arkane-dev/book-companion-notebooks.git
cd book-companion-notebooks
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
jupyter labNo install: Google Colab
Colab opens any notebook from GitHub in the browser. Most packages are already installed. Open a notebook by its address, for example the Chapter 1 notebook:
https://colab.research.google.com/github/arkane-dev/book-companion-notebooks/blob/main/book1/ch01/history_and_landscape.ipynb
Run this in the first cell to add anything missing:
%pip install -q duckdb optuna umap-learnColab sessions reset. Save your work to Google Drive or download it before you close the tab.
Check it works
Run this in a new notebook. It's Procedure 6.1 in short form.
import sys
import numpy, pandas, sklearn, duckdb, statsmodels, matplotlib
print("Python", sys.version.split()[0])
for m in (numpy, pandas, sklearn, duckdb, statsmodels, matplotlib):
print(f"{m.__name__:12} {m.__version__}")
print(duckdb.sql("SELECT 42 AS answer").df())You should see a version for each package and a table with 42 in it. Then open book1/ch01/ and run the Chapter 1 notebook top to bottom.
Where to keep your work
Keep your own work outside the notebooks folder, so updates to the course notebooks don't clash with it. One folder per week works well:
my-course/
week-01/
week-02/
...
capstone/
data/
notebooks/
report.md
README.mdChapter 10 (Procedure 10.4) suggests a fuller layout for the capstone.
The labs
Each lab downloads its own data with one line of code. Nothing else to install. The datasets page lists every source and license.
When something breaks
ModuleNotFoundError: the notebook isn't using your course environment. In Jupyter, check the kernel. With uv, start Jupyter withuv run.- A download fails: check your connection, then the datasets page. Sources sometimes move. If one has, tell your instructor.
- Anything else: Procedure 6.5 in Chapter 6 covers the common stack errors.