0.4 Set up your computer (do this now, ~20 minutes)
You need Python 3.10+ and a few packages. You do not need a GPU for most of this guide; the two places where one helps are flagged.
Step 1 — Install Python
- Mac:
brew install python@3.12(or download from python.org) - Windows: install from python.org, tick "Add Python to PATH"
- Linux:
sudo apt install python3 python3-pip python3-venv
Check it:
python3 --version # should print 3.10 or higher
Step 2 — Make a project folder with an isolated environment
An environment keeps this project's packages separate from your system, so you can't break anything.
mkdir ai-learning && cd ai-learning
python3 -m venv .venv # create the environment
source .venv/bin/activate # activate it (Mac/Linux)
# Windows: .venv\Scripts\activate
Your prompt should now start with (.venv). You must run activate every
time you open a new terminal.
Step 3 — Install the packages
pip install --upgrade pip
pip install numpy scikit-learn matplotlib jupyter
pip install torch # the neural-network library
pip install transformers tokenizers datasets
pip install gensim tiktoken
pip install sentence-transformers faiss-cpu # for the RAG project
If torch fails or is huge, that's fine — install it when you reach Part 4.
For a CPU-only, smaller install: see https://pytorch.org/get-started/locally/
and pick "CPU".
Step 4 — Check everything works
Save this as check_setup.py and run python3 check_setup.py:
import sys
print("python", sys.version.split()[0])
ok = True
for name in ["numpy", "sklearn", "torch", "transformers", "tiktoken"]:
try:
m = __import__(name)
v = getattr(m, "__version__", "?")
print(f" OK {name:15s} {v}")
except ImportError as e:
print(f" MISSING {name} ({e})")
ok = False
if ok:
import torch
print("torch sees GPU:", torch.cuda.is_available()) # False is fine
print("\nSetup looks good. You are ready.")
Step 5 — Learn to use a notebook (optional but recommended)
jupyter notebook
A browser opens. New -> Python 3. Type code in a cell, press Shift+Enter to
run it. Notebooks are ideal for experimenting because you can re-run one piece
without re-running everything.
If something breaks
- Read the last line of the error first — that's the actual problem.
ModuleNotFoundError: No module named 'x'-> you forgotactivate, or needpip install x.- Copy the exact error into a search engine. Someone has had it.
- Write the error + fix into your
notes.md. You will hit it again.