Phase 00: Setup & Tooling

Dev Environment

Your tools shape your thinking. Set them up once, set them up right.

Type: Build

Languages: Python, Node.js, Rust

Prerequisites: None

Time: ~45 minutes

🎯 Learning Objectives
  • Set up Python 3.11+, Node.js 20+, and Rust toolchains from scratch
  • Configure virtual environments and package managers for reproducible builds
  • Verify GPU access with CUDA/MPS and run a test tensor operation
  • Understand the four-layer stack: system, packages, runtimes, AI libraries

The Problem

You're about to learn AI engineering across 500+ lessons using Python, TypeScript, Rust, and Julia. If your environment is broken, every single lesson becomes a fight against tooling instead of learning.

Most people skip environment setup. Then they spend hours debugging import errors, version conflicts, and missing CUDA drivers. We're going to do this once, properly.

The Concept

An AI engineering environment has four layers:

graph TD
    A["4. AI/ML Libraries\nPyTorch, JAX, transformers, etc."] --> B["3. Language Runtimes\nPython 3.11+, Node 20+, Rust, Julia"]
    B --> C["2. Package Managers\nuv, pnpm, cargo, juliaup"]
    C --> D["1. System Foundation\nOS, shell, git, editor, GPU drivers"]

We install bottom-up. Each layer depends on the one below it.

Build It

Step 1: System Foundation

Check your system and install the basics.

bash# macOS
xcode-select --install
brew install git curl wget

# Ubuntu/Debian
sudo apt update && sudo apt install -y build-essential git curl wget unzip

# Windows (use WSL2)
wsl --install -d Ubuntu-24.04

Step 2: Python with uv

We use uv — it's 10-100x faster than pip and handles virtual environments automatically.

bashcurl -LsSf https://astral.sh/uv/install.sh | sh

uv python install 3.12

uv venv
source .venv/bin/activate  # or .venv\Scripts\activate on Windows

uv pip install numpy matplotlib jupyter

Verify:

pythonimport sys
print(f"Python {sys.version}")

import numpy as np
print(f"NumPy {np.__version__}")
a = np.array([1, 2, 3])
print(f"Vector: {a}, dot product with itself: {np.dot(a, a)}")

Step 3: Node.js with pnpm

For TypeScript lessons (agents, MCP servers, web apps).

bashcurl -fsSL https://fnm.vercel.app/install | bash
fnm install 22
fnm use 22

npm install -g pnpm

node -e "console.log('Node', process.version)"

The fnm installer checks for unzip first and exits with Not installing fnm due to missing dependencies. when it is absent: on Linux it unpacks a zip archive, on macOS it installs through Homebrew. macOS ships unzip; Ubuntu, Debian, and WSL2 get it from the Step 1 apt line (sudo apt install -y unzip if you skipped that step).

macOS / Apple Silicon (M1/M2/M3/M4): If the installer stops with Error: Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew), your terminal is running under Rosetta 2 (arch prints i386) while Homebrew is a native arm64 build. Install fnm forcing arm64, wire it into your shell, then rerun the commands above from fnm install 22:

basharch -arm64 brew install fnm
echo 'eval "$(fnm env --use-on-cd)"' >> ~/.zshrc
source ~/.zshrc

Step 4: Rust

For performance-critical lessons (inference, systems).

bashcurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

rustc --version
cargo --version

Step 5: Julia (Optional)

For math-heavy lessons where Julia shines.

bashcurl -fsSL https://install.julialang.org | sh

julia -e 'println("Julia ", VERSION)'

Step 6: GPU Setup (If You Have One)

NVIDIA (Linux / Windows):

bashnvidia-smi

# Install PyTorch with CUDA
uv pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124

macOS / Apple Silicon (M1/M2/M3/M4): There is no CUDA on a Mac — that's expected, not a failure. Do not pass --index-url .../cuXXX (those wheels are Linux/Windows only, so the install fails). Install the plain build, which includes Apple's MPS (Metal) GPU backend:

bashuv pip install torch torchvision torchaudio

Verify (works on any platform):

pythonimport torch
print(f"CUDA available: {torch.cuda.is_available()}")           # False on macOS — expected
print(f"MPS available:  {torch.backends.mps.is_available()}")   # True on Apple Silicon
if torch.cuda.is_available():
    print(f"GPU: {torch.cuda.get_device_name(0)}")

No GPU? No problem. Most lessons work on CPU. For training-heavy lessons, use Google Colab or cloud GPUs.

Step 7: Verify the route you want to start

Run every command in this lesson from the repository root, the directory that

contains README.md and phases/. The preflight checks only what you need to

start the selected route. It skips later tools by default so a new learner sees

one clear answer instead of a wall of warnings.

Start the full beginner sequence:

bashpython3 phases/00-setup-and-tooling/01-dev-environment/code/verify.py --route beginner

Or check only the route you want:

bashpython3 phases/00-setup-and-tooling/01-dev-environment/code/verify.py --route ml-foundations
python3 phases/00-setup-and-tooling/01-dev-environment/code/verify.py --route llm-engineering
python3 phases/00-setup-and-tooling/01-dev-environment/code/verify.py --route agents
python3 phases/00-setup-and-tooling/01-dev-environment/code/verify.py --route mcp
python3 phases/00-setup-and-tooling/01-dev-environment/code/verify.py --route agent-skills
python3 phases/00-setup-and-tooling/01-dev-environment/code/verify.py --route certification

Add --show-later when you want the same preflight to inspect optional tools

and dependencies used by later lessons. A missing later tool never blocks the

selected route.

Each failed required check includes the detected path or import error and an

exact corrective command. The Agent Skills and certification routes also show

manual host checks because a Python script cannot prove that an AI host has

discovered a skill or that your chosen skill scope is writable.

When the beginner preflight passes, it prints the exact first runnable lesson:

textReady to start Beginner course.
Next: python3 phases/01-math-foundations/01-linear-algebra-intuition/code/vectors.py

Use It

Your environment is ready to start the route you checked. Install later tools

when a lesson asks for them instead of blocking your first lesson on the whole

stack. Here is what you will use across the curriculum:

LanguageUsed InPackage Manager
PythonPhases 1-12 (ML, DL, NLP, Vision, Audio, LLMs)uv
TypeScriptPhases 13-17 (Tools, Agents, Swarms, Infra)pnpm
RustPhases 12, 15-17 (Performance-critical systems)cargo
JuliaPhase 1 (Math foundations)Pkg

Ship It

This lesson produces a verification script that anyone can run to check their setup.

See outputs/prompt-env-check.md for a prompt that helps AI assistants diagnose environment issues.

Exercises

  1. Run the verification script and fix any failures
  2. Create a Python virtual environment for this course and install PyTorch
  3. Write a "hello world" in all four languages and run each one

Hints

Exercise 1. Run python3 phases/00-setup-and-tooling/01-dev-environment/code/verify.py --route beginner from the repository root and fix the first failed line before you look at the next one. The check is done when you run the script again and every required probe passes.

Exercise 2. Make the environment with uv venv in the repository root, activate it, then install PyTorch with the command from Step 6 that matches your hardware. Run python -c "import torch; print(torch.__version__)" inside the environment; a version number means the install worked.

Exercise 3. Use the four runtimes from the stack in The Concept: Python, TypeScript on Node.js, Rust, and Julia. Write one small file for each and run it with python3, npx tsx (Node.js cannot run a .ts file directly), cargo run or rustc, and julia. Each run must print your message and exit with code 0.

This free lesson is part of the AI Engineering from Scratch curriculum. Read the full explanation, run the lesson code, and verify the result in the interactive reader or from the repository source.

Browse the complete course catalog or open this lesson on GitHub.