Phase 00: Setup & Tooling

Python Environments

Dependency hell is real. Virtual environments are the cure. Create isolated virtual environments using uv, venv, or conda. Write a pyproject.toml with optional dependency groups and generate lockfiles for reproducibility. Diagnose and fix common pitfalls: global installs, pip/conda mixing, CUDA version mismatches. Implement a per-phase environment strategy for projects with conflicting dependencies. You install PyTorch 2.4 for a fine-tuning project. Next week, a different project needs PyTorch 2.1 because its CUDA build is pinned. You upgrade globally, and the first project breaks. You downgrade, and the second one breaks. This is dependency hell. It happens constantly in AI/ML work because: PyTorch, JAX, and TensorFlow each ship their own CUDA bindings. Model libraries pin specific framework versions. A global pip install overwrites whatever was there before. CUDA 11.8 builds don't work with CUDA 12.x drivers (and vice versa). The fix: every project gets its own isolated environment with its own packages. uv is the fastest Python package manager (10-100x faster than pip). It handles virtual environments, Python versions, and dependency resolution in one tool. Install packages: Create a project with pyproject.toml in one step: If you can't install uv, Python ships with venv: Slower than uv, but works everywhere Python is installed. Conda manages non-Python dependencies like CUDA toolkits, cuDNN, and C libraries. Use it when: You need a specific CUDA…

Python Environments: Dependency hell is real. Virtual environments are the cure. Create isolated virtual environments using uv, venv, or conda. Write a…

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.