Set up the ideal ML development environment: OS, terminal, VS Code, Python, Git, Jupyter, Docker, and AI coding assistants.
This chapter is completely optional for this course. You can skip straight to Python Foundations and start learning right away. That said, most professional AI/ML developers use this exact setup — so if you want to build the same environment the industry uses, this is worth your time.
Before writing a single line of ML code, you need a properly configured development environment. This chapter walks you through setting up everything from scratch — even if you've never programmed before.
A good setup is invisible: it stays out of your way and lets you focus on learning. A bad setup creates constant friction — packages that won't install, code that runs differently on different machines, and hours lost debugging environment issues instead of building models.
The ML developer's toolkit:
Each topic includes installation steps, configuration, and practical tips. By the end of this chapter, you'll have a professional-grade ML development environment ready to go.
Click any topic to jump in
Ubuntu, macOS, or Windows with WSL2 — choosing the right OS and installing system packages for ML.
Command line and editor
Navigation, file operations, pipes, and process management — the command center for all ML work.
The editor, extensions for Python and Jupyter, keyboard shortcuts — where you'll write all your code.
Python and Git
Python 3.11+, virtual environments, pip — properly isolated Python that won't break your system.
Version control for tracking experiments, collaborating, and never losing work.
Interactive computing and containers
Interactive code cells, inline plots, and markdown — the standard for ML exploration and visualization.
Containers for reproducible environments — run the same code anywhere without dependency conflicts.
Claude Code, Copilot, and VS Code extensions — AI tools that accelerate your coding workflow.
Your operating system is the foundation everything else runs on. In machine learning, the vast majority of tools, libraries, and tutorials assume a Unix-based system — that means Linux or macOS. This isn't just preference; it's practical reality.
Ubuntu (Linux) is the gold standard for ML development:
macOS is also excellent — it's Unix-based, so most Linux commands work identically. Apple Silicon (M1/M2/M3/M4) chips have strong ML performance through Metal and MLX.
Windows works, but requires extra setup. The Windows Subsystem for Linux (WSL2) gives you a full Ubuntu environment inside Windows. Without WSL, you'll constantly run into compatibility issues with Python packages, file paths, and shell scripts.
Ubuntu is the most widely used OS in ML development. Nearly all cloud instances, Docker containers, and CI/CD pipelines run Ubuntu, so learning it means your local setup matches production. NVIDIA's CUDA toolkit and GPU drivers receive first-class support on Ubuntu, with the latest versions always available through official repos. If you're starting fresh, Ubuntu 22.04 LTS is the safest choice — it has the widest package compatibility and 5 years of security updates.
# Check your Ubuntu version lsb_release -a # Check kernel version uname -r # Check system architecture arch
Distributor ID: Ubuntu Description: Ubuntu 22.04.4 LTS Release: 22.04 Codename: jammy 6.5.0-44-generic x86_64
macOS is Unix-based, which means nearly all Linux terminal commands work out of the box — no compatibility layers needed. Apple Silicon chips (M1/M2/M3/M4) deliver strong ML performance through Apple's Metal framework and the MLX library optimized for on-device training. The developer experience is polished: Homebrew makes installing packages painless, and tools like iTerm2 and Raycast boost productivity. The main limitation is that NVIDIA CUDA is not available on macOS, so if your workflow depends heavily on CUDA-specific libraries, you'll need a Linux machine or cloud GPU for those tasks.
# Check macOS version sw_vers # Check if running Apple Silicon or Intel uname -m # arm64 = Apple Silicon, x86_64 = Intel # Install Homebrew (macOS package manager) /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" # Verify Homebrew brew --version
ProductName: macOS ProductVersion: 14.4 BuildVersion: 23E214 arm64 Homebrew 4.2.10
WSL2 (Windows Subsystem for Linux) runs a real Linux kernel inside Windows, giving you full Ubuntu access without dual-booting. Run wsl --install in an admin PowerShell and reboot — you'll have a working Ubuntu terminal in minutes. File system performance is best when you keep your project files inside the Linux filesystem (~/projects/) rather than in /mnt/c/. VS Code's Remote-WSL extension connects seamlessly, so you edit in Windows but run code in Linux.
# Run in PowerShell as Administrator: wsl --install # After reboot, set Ubuntu as default wsl --set-default Ubuntu # Check WSL version wsl --list --verbose # Enter WSL from PowerShell wsl # Inside WSL, verify you're running Linux uname -a
NAME STATE VERSION * Ubuntu Running 2 Linux DESKTOP-ABC123 5.15.153.1-microsoft-standard-WSL2 x86_64 GNU/Linux
Plain Windows uses backslash path separators (C:\Users\...) while virtually all ML code and documentation assumes forward slashes (/home/user/...). Many Python packages with C extensions fail to compile on Windows because they expect Unix build tools like make and gcc. Shell scripts, Dockerfiles, and CI configurations are written for bash, not PowerShell or CMD. Even when packages do install, subtle differences in file handling, line endings, and environment variables cause hard-to-debug issues that waste hours.
# Demonstrate the path separator difference # Linux/macOS (forward slashes): echo $HOME # /home/user # Windows CMD (backslashes): # echo %USERPROFILE% # C:\Users\user # Check if common Unix tools exist which make gcc bash # On Linux/macOS these exist; on plain Windows they don't # This is why ML tools break on Windows without WSL
/home/user /usr/bin/make /usr/bin/gcc /usr/bin/bash
Google Colab gives you free GPU access (T4) through a Jupyter-like interface in your browser — no local setup required, just a Google account. For more control, AWS EC2 and Lambda Labs offer GPU instances you can SSH into and configure exactly like a local machine. Cloud GPUs are essential if you need to train large models but don't have a local NVIDIA GPU. For this course, a cloud GPU is not necessary — all exercises run fine on CPU — but knowing these options exist helps when you're ready to scale up.
# Check if you have a GPU locally nvidia-smi 2>/dev/null && echo "GPU available" || echo "No NVIDIA GPU found" # SSH into a cloud GPU instance (example) # ssh user@your-cloud-instance # Check GPU on remote machine # nvidia-smi # Google Colab — no install needed: # 1. Go to colab.research.google.com # 2. Runtime → Change runtime type → T4 GPU # 3. Run: !nvidia-smi
No NVIDIA GPU found
These packages are required by almost every ML project and Python library.
These system packages form the foundation. build-essential provides the C/C++ compiler needed to install many Python packages from source. libgl1-mesa-glx is required by OpenCV.
# Update package list and upgrade existing packages sudo apt update && sudo apt upgrade -y # Install essential build tools (needed to compile Python packages) sudo apt install -y build-essential curl wget git # Install Python prerequisites sudo apt install -y python3 python3-pip python3-venv python3-dev # Install libraries needed by OpenCV, Pillow, and other ML packages sudo apt install -y libssl-dev libffi-dev libgl1-mesa-glx libglib2.0-0 # Install Node.js (needed for Claude Code CLI and Jupyter extensions) curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - sudo apt install -y nodejs # Verify installations python3 --version git --version node --version
Python 3.12.3 git version 2.43.0 v20.11.0
Configure bash/zsh with useful aliases and environment variables for ML work.
Shell aliases save keystrokes on commands you type hundreds of times. 'activate' is much faster than 'source .venv/bin/activate', and 'gs' is faster than 'git status'.
# Add useful aliases to your shell profile # (Use ~/.zshrc on macOS with zsh, ~/.bashrc on Ubuntu/WSL) echo '' >> ~/.bashrc echo '# ML Development Aliases' >> ~/.bashrc echo 'alias py="python3"' >> ~/.bashrc echo 'alias activate="source .venv/bin/activate"' >> ~/.bashrc echo 'alias jl="jupyter lab"' >> ~/.bashrc echo 'alias gs="git status"' >> ~/.bashrc echo 'alias gc="git commit"' >> ~/.bashrc echo 'alias gp="git push"' >> ~/.bashrc # Reload your shell profile source ~/.bashrc # Test an alias gs # Same as "git status"
SSH keys let you push to GitHub without typing your password every time. You can skip this and use HTTPS instead — SSH is just more convenient long-term.
SSH keys use public-key cryptography. Your private key stays on your machine; the public key goes to GitHub. This is more secure than passwords and saves time on every push/pull.
# Generate an SSH key (press Enter for defaults) ssh-keygen -t ed25519 -C "[email protected]" # Start the SSH agent eval "$(ssh-agent -s)" # Add your key to the agent ssh-add ~/.ssh/id_ed25519 # Copy the public key to clipboard cat ~/.ssh/id_ed25519.pub # Copy the output, then: # Go to GitHub → Settings → SSH Keys → New SSH Key → Paste # Test the connection ssh -T [email protected]
Hi username! You've successfully authenticated, but GitHub does not provide shell access.