Welcome! π If youβre here, youβre probably trying to build the Machine Learning Systems book locally on your own machine.
This guide will walk you through how to get set up manually, especially if you're not using GitHub Actions or Docker. We'll cover what tools you need, why you need them, and how to test everything is working.
For most users, the easiest way is using our Book Binder CLI:
# First time setup
./binder setup
# System health check
./binder doctor
# Quick chapter preview (HTML with live reload)
./binder preview intro
# Build specific chapter(s)
./binder build intro # Single chapter (HTML)
./binder build intro,ml_systems # Multiple chapters (HTML)
# Build complete book
./binder build # Complete book (HTML)
./binder pdf # Complete book (PDF)
./binder epub # Complete book (EPUB)
# Get help
./binder helpThe binder tool automatically handles all dependencies, configuration, and build processes for you!
This project is written using Quarto, which lets us render:
- A website (HTML version of the book)
- A typeset PDF (for printable reading)
By default, Quarto can build the HTML version pretty easily. But building the PDF version is a bit trickier β it requires LaTeX, Inkscape, and a few other tools to properly render graphics and fonts.
| Tool | Why It's Needed | Version |
|---|---|---|
| Quarto | The core tool that converts the .qmd files into HTML/PDF |
1.7.31+ |
| Python | Required for Book Binder CLI and build scripts | 3.9+ |
| Python packages | Dependencies (see tools/dependencies/requirements.txt) |
See below |
| R | Some chapters include R code chunks and R-based plots | 4.0+ |
| R packages | Supporting packages (defined in tools/dependencies/install_packages.R) |
Latest |
| TinyTeX + TeX Live | Needed for LaTeX β PDF rendering | Latest |
| Inkscape | Converts .svg diagrams into .pdf (especially TikZ) |
1.0+ |
| Ghostscript | Compresses large PDF files | Latest |
| System libraries | Fonts and rendering support (Linux systems) | Various |
Don't worry β this guide will walk you through installing all of them, step by step.
The project uses a modern Python packaging setup with pyproject.toml. Core dependencies include:
Core Build Dependencies:
jupyterlab-quarto>=0.3.0- Quarto integrationjupyter>=1.0.0- Jupyter notebook supportpybtex>=0.24.0- Bibliography processingpypandoc>=1.11- Document conversionpyyaml>=6.0- Configuration managementrich>=13.0.0- CLI formatting and output
Data Processing:
pandas>=2.0.0- Data manipulationnumpy>=1.24.0- Numerical computingPillow>=9.0.0- Image processing
Additional Tools:
openai>=1.0.0- AI-assisted content toolsgradio>=4.0.0- Interactive interfacesghostscript>=0.7- PDF compressionpre-commit>=3.0.0- Code quality hooks
For the complete list, see tools/dependencies/requirements.txt and pyproject.toml.
Quarto is what drives the entire build process.
wget https://github.com/quarto-dev/quarto-cli/releases/download/v1.7.31/quarto-1.7.31-linux-amd64.deb
sudo dpkg -i quarto-1.7.31-linux-amd64.debTest it with:
quarto --versionIf you're using Ubuntu or Debian:
sudo apt-get update
sudo apt-get install -y r-baseTest R:
R --versionOnce R is installed, open it by typing R, then run:
install.packages("remotes")
source("tools/dependencies/install_packages.R")This installs everything the book needs to render code, plots, etc. The R package dependencies are centrally managed in tools/dependencies/install_packages.R.
TinyTeX is a lightweight version of TeX Live, which Quarto uses to generate PDFs.
quarto install tinytexThen add it to your shell:
echo 'export PATH=$HOME/.TinyTeX/bin/x86_64-linux:$PATH' >> ~/.bashrc
source ~/.bashrcThese give us broader LaTeX support:
sudo apt-get install -y texlive-latex-recommended texlive-fonts-recommended texlive-latex-extra \
texlive-pictures texlive-luatexThis is needed to convert .svg images into .pdf (especially for TikZ diagrams).
sudo add-apt-repository ppa:inkscape.dev/stable -y
sudo apt-get update
sudo apt-get install -y inkscapeTest with:
inkscape --versionsudo apt-get install -y ghostscriptsudo apt-get install -y python3 python3-pip python3-venvTest with:
python3 --version # Should be 3.9 or higher
pip3 --versionThe project uses modern Python packaging. Install all dependencies with:
# Option 1: Using pip (recommended)
pip install -r requirements.txt
# Option 2: Install in development mode (includes CLI as command)
pip install -e .
# Option 3: Using a virtual environment (best practice)
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtWhat gets installed:
- Book Binder CLI and all build tools
- Jupyter and Quarto integration packages
- Data processing libraries (pandas, numpy)
- AI/ML tools for content assistance
- Pre-commit hooks for code quality
The requirements.txt file points to tools/dependencies/requirements.txt, which contains all production and development dependencies.
Once you've installed everything, run the health check:
./binder doctorThis will verify:
- β Quarto installation
- β Python and dependencies
- β R and required packages
- β LaTeX and TinyTeX
- β Inkscape and Ghostscript
- β Configuration files
- β Build directory structure
If everything passes, you're ready to build the book!
Navigate to the root folder of the project:
cd path/to/MLSysBookThe book uses a dual-configuration approach that automatically switches between optimized settings for different output formats:
quarto/config/_quarto-html.ymlβ Optimized for interactive website (clean navigation, TikZβSVG, cross-references)quarto/config/_quarto-pdf.ymlβ Optimized for academic PDF (full citations, LaTeX rendering, book structure)quarto/config/_quarto-epub.ymlβ Optimized for EPUB (e-reader format, reflowable content)
The Binder CLI automatically handles configuration switching using symlinks β no manual file management needed!
The recommended way to build the book is using the Book Binder CLI:
./binder build # Complete website (HTML)
./binder pdf # Complete book (PDF)
./binder epub # Complete e-book (EPUB)./binder build intro # Single chapter (HTML)
./binder build intro,ml_systems # Multiple chapters (HTML)
./binder pdf intro # Single chapter (PDF, selective build)./binder preview # Preview complete book
./binder preview intro # Preview specific chapter
./binder preview intro,ml_systems # Preview multiple chapters./binder clean # Clean build artifacts
./binder status # Show current status
./binder list # List all available chapters
./binder doctor # Run comprehensive health check
./binder help # Show all commandsOutput Locations:
- HTML:
build/html/ - PDF:
build/pdf/ - EPUB:
build/epub/
If you need direct control without the Binder CLI:
cd quarto
ln -sf config/_quarto-html.yml _quarto.yml
quarto render --to htmlcd quarto
ln -sf config/_quarto-pdf.yml _quarto.yml
quarto render --to=titlepage-pdfcd quarto
ln -sf config/_quarto-epub.yml _quarto.yml
quarto render --to epubImportant: The Binder CLI is strongly recommended as it:
- β Handles configuration switching automatically
- β Manages build artifacts and cleanup
- β Provides progress indicators
- β Validates system health
- β Supports fast/selective builds
- Windows 10 or later
- Administrator access for some installations
Download and install from quarto.org
Download from python.org or use Windows Store.
Important: Check "Add Python to PATH" during installation.
Download from CRAN
Open R and run:
install.packages("remotes")
source("tools/dependencies/install_packages.R")From R console:
install.packages("tinytex")
tinytex::install_tinytex()Open PowerShell (as Administrator):
# Install Chocolatey if not already installed
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
# Install tools
choco install inkscape ghostscript -yOpen Command Prompt or PowerShell in the project directory:
# Create virtual environment (recommended)
python -m venv .venv
.venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtRun the health check:
python binder doctorOr test building:
python binder build intro
python binder pdfQuarto not found?
# Verify installation
quarto --version
# Check PATH (Linux/macOS)
echo $PATH | grep quarto
# Reinstall if needed
# Linux: sudo dpkg -i quarto-*.deb
# macOS: brew install --cask quarto
# Windows: Download from quarto.orgPython version issues?
# Check Python version (must be 3.9+)
python --version
python3 --version
# Use specific version if multiple installed
python3.9 --versionDependencies not installing?
# Upgrade pip first
pip install --upgrade pip setuptools wheel
# Try with verbose output
pip install -r requirements.txt -v
# If SSL errors occur
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org -r requirements.txtPDF build fails?
- Verify LaTeX is installed:
pdflatex --version - Verify Inkscape is installed:
inkscape --version - Check TinyTeX path:
tinytex::tinytex_root()in R - Try rebuilding from scratch:
./binder clean ./binder pdf
Chapter not found?
# List all available chapters
./binder list
# Use exact chapter names (case-sensitive)
./binder build intro # β correct
./binder build Intro # β wrongBuild artifacts detected?
# Clean all build artifacts
./binder clean
# Check status
./binder status
# Run health check
./binder doctorConfiguration issues?
# Check current configuration
ls -la quarto/_quarto.yml
# Should be a symlink to config/_quarto-html.yml or config/_quarto-pdf.yml
# If not, recreate:
cd quarto
ln -sf config/_quarto-html.yml _quarto.ymlmacOS: Inkscape not in PATH?
# Add Inkscape to PATH
echo 'export PATH="/Applications/Inkscape.app/Contents/MacOS:$PATH"' >> ~/.zshrc
source ~/.zshrcLinux: Missing system libraries?
# Install common missing libraries
sudo apt-get install -y libcairo2-dev libharfbuzz-dev libfribidi-dev \
libfreetype6-dev libpng-dev libtiff5-dev libjpeg-devWindows: Permission errors?
# Run PowerShell as Administrator
# Disable execution policy temporarily
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope ProcessIf you're still having issues:
- Run the health check:
./binder doctor - Check the logs: Look for detailed error messages
- Consult documentation:
- BINDER.md - Binder CLI guide
- DEVELOPMENT.md - Development setup
- Ask for help:
- GitHub Discussions: https://github.com/harvard-edge/cs249r_book/discussions
- GitHub Issues: https://github.com/harvard-edge/cs249r_book/issues
The project uses modern Python packaging standards with pyproject.toml:
MLSysBook/
βββ pyproject.toml # Python project configuration
βββ requirements.txt # Points to tools/dependencies/requirements.txt
βββ tools/
β βββ dependencies/
β βββ requirements.txt # Actual dependencies
β βββ install_packages.R # R dependencies
βββ cli/ # Modular CLI package
βββ main.py # CLI entry point
βββ commands/ # Command implementations
βββ core/ # Core functionality
βββ utils/ # Utilities
Standard Installation (Recommended):
pip install -r requirements.txtDevelopment Installation:
# Installs package in editable mode with CLI as command
pip install -e .
# Now you can use:
binder build
mlsysbook build # Alternative command nameWith Optional Dependencies:
# Install with AI features
pip install -e ".[ai]"
# Install with development tools
pip install -e ".[dev]"
# Install everything
pip install -e ".[ai,dev]"The pyproject.toml defines:
- Minimum Python version: 3.9+
- Core dependencies: Listed in
dependenciessection - Optional dependencies: AI tools, dev tools, build tools
- Entry points:
binderandmlsysbookcommands - Code quality tools: Black, isort, pylint, mypy configurations
- Testing setup: Pytest with coverage
- β Standards-compliant packaging
- β Proper dependency management
- β CLI installed as system command
- β Supports pip, poetry, and other tools
- β Easy distribution and installation
Once everything is set up, you'll be able to:
- π Preview changes locally with live reload:
./binder preview intro - π¨ Build individual chapters for fast iteration:
./binder build intro - π Build complete book in multiple formats:
./binder build,./binder pdf,./binder epub - π Validate your setup anytime:
./binder doctor - π§Ή Clean up artifacts:
./binder clean
- π Make edits to chapter content in
quarto/contents/ - β Test locally before committing
- π€ Follow best practices with pre-commit hooks
- πͺ Contribute like a pro to the open-source book
- Read BINDER.md for complete CLI reference
- Check DEVELOPMENT.md for development workflow
- Review contribute.md for contribution guidelines
- Join discussions at GitHub Discussions
- BINDER.md - Complete Book Binder CLI reference
- DEVELOPMENT.md - Development guidelines and workflow
- contribute.md - Contribution guidelines
- PUBLISH_LIVE_WORKFLOW.md - Publishing workflow
- GitHub Discussions - Ask questions and share knowledge
- GitHub Issues - Report bugs and request features
- MLSysBook.ai - Main website and learning platform
The tools/scripts/ directory contains various utilities:
content/- Content management toolscross_refs/- Cross-reference managementgenai/- AI-assisted content toolsglossary/- Glossary managementmaintenance/- System maintenance scriptspublish/- Publishing and deployment tools
Run ./binder help to see all available commands and their descriptions.
We welcome contributions! The easiest way to get started:
- Fork and clone the repository
- Set up your environment:
./binder setup - Make your changes to content or code
- Test locally:
./binder preview <chapter> - Submit a pull request
For detailed contribution guidelines, see contribute.md.
Last Updated: October 2025 Project: Machine Learning Systems - Principles and Practices Website: https://mlsysbook.ai