Part 01 / Topic 1 of 7
Setting up
AI code depends on a stack of packages — NumPy, pandas, scikit-learn, PyTorch — and their versions matter. A model trained under one version can behave differently under another. So every AI project starts the same way: a virtual environment with pinned versions.
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
Real-world example: Two teammates get different accuracy numbers from the same script. The cause is almost always different package versions — which a shared requirements.txt prevents.
This repo's requirements.txt pins the exact versions every example was run with. Where you work matters less: VS Code, Jupyter, or a plain terminal all work. The course uses plain .py files so everything is runnable and diffable.
🧪 Quick quiz — answer from memory, then check.
- Why use a virtual environment for an AI project?
Show the answer
It isolates the project's package versions from other projects — each project pins its own numpy, torch and so on, so upgrading one project does not break another.
Done here? The practice set for Part 1 — 4 exercises with solutions — is on the part page.