For participants and self-guided learners

Physical AI Lab
Setup Guide

Everything you need to go from a fresh machine to running the lab hub — usually under 15 minutes.

Written by Jim Seelan

This is the setup guide for Physical AI Lab — a hands-on session where you build the complete Physical AI pipeline from webcam to robot arm in three hours.

Visit the lab →

The short version: double-click setup.bat and wait. The script handles everything and opens the browser when it's done. The steps below are just there in case you want to know what's happening.

Before you start

Steps

  1. Get the repository

    Clone it with Git, or download the ZIP from GitHub and unzip it somewhere sensible.

    git clone https://github.com/learnermaker/physical-ai-lab.git
    cd physical-ai-lab
  2. Double-click setup.bat

    No admin rights needed. A terminal window will open and work through the setup automatically. Total time is usually 10–15 minutes on a decent connection.

    Windows SmartScreen If you see a blue "Windows protected your PC" dialog, click More info then Run anyway. This shows up for any script downloaded from the internet.

    Here's what it does:

    StageWhat happens
    [1/9]Looks for Python 3.12 — downloads and installs it quietly if not found
    [2/9]Creates a .venv folder inside the repo (isolated Python environment)
    [3/9]Activates the environment
    [4/9]Installs PyTorch CPU-only (the big one — about 200 MB)
    [5/9]Installs everything else from requirements.txt
    [6/9]Registers the kernel so VS Code notebooks can use this environment
    [7/9]Downloads models and demo assets: hand_landmarker.task (~8 MB), the pre-trained SAC agent for Module 2 (~3 MB), and the fallback demo video
    [8/9]Runs a quick check — prints pass/warn/fail for each package
    [9/9]Opens the hub server and launches the browser
  3. Read the verification output

    Step 8 prints something like this:

    [PASS] numpy
    [PASS] mujoco
    [PASS] gymnasium
    ...
    [WARN] Camera unavailable -- fallback video will be used
    ...
    Setup complete: 13/14 checks passed

    [WARN] is fine — the lab has built-in fallbacks for webcam and OpenGL. [FAIL] means something needs fixing; the script prints the exact pip install command to run.

  4. Get a Gemini API key optional

    Module 5 can call Google Gemini live to analyse camera frames. You don't need a key — it falls back to pre-recorded responses — but live results are noticeably more interesting.

    Get a free key at aistudio.google.com (sign in → Get API key), then:

    # In the repo folder — Windows
    copy .env.example .env
    # Open .env in Notepad and add your key:
    # GEMINI_API_KEY=AQ....your_key
Optional warm-up before Module 3 Run this to see what a million training steps actually looks like before you train your own agent:
python modules/02_simulation/03_pretrained_agent.py
A MuJoCo window opens with a HalfCheetah robot running. No GPU required.
Safe to re-run If something fails partway through, just run setup.bat again. It detects what's already done and skips those steps.

If you'd rather do it yourself — or if setup.bat is giving you grief — here are the individual steps. You'll need Python 3.12 installed first. Estimated time: 20–30 minutes on a decent connection.

What you need

1. Clone the repo

git clone https://github.com/learnermaker/physical-ai-lab.git
cd physical-ai-lab

2. Create and activate a virtual environment

This keeps the lab packages separate from everything else on your machine.

# Create
py -3.12 -m venv .venv

# Activate (Windows)
.venv\Scripts\activate

# Your prompt should now show (.venv)
Keep this terminal open All the commands below need to run in the activated environment. If you close the terminal and come back, run .venv\Scripts\activate again before continuing.

3. Upgrade pip

python -m pip install --upgrade pip

4. Install PyTorch (CPU build)

This needs to go in before the rest so that packages like Stable-Baselines3 link against the right version. It's about 200 MB so give it a minute.

pip install torch==2.14.0+cpu --index-url https://download.pytorch.org/whl/cpu

# Quick check:
python -c "import torch; print(torch.__version__)"
# Should print: 2.14.0+cpu

5. Install lab packages

pip install -r requirements.txt

# Installs: numpy, mujoco, gymnasium, stable-baselines3,
# opencv-python, mediapipe, google-genai, fastapi, and more.
# Around 500 MB. Takes 3–10 minutes.

6. Register the Jupyter kernel

python -m ipykernel install --user --name physical-ai --display-name "Physical AI Lab"

7. Download models and demo assets

These are gitignored large binaries — download_model.py fetches them in one step. Run it from the activated environment:

python download_model.py

This downloads:

All three are idempotent — safe to re-run, skips anything already present.

8. Verify

python verify_install.py

All 14 checks should be [PASS] or [WARN]. A warning just means a fallback is active — the lab still works.

9. Add your Gemini key optional

copy .env.example .env
# Edit .env and set:
# GEMINI_API_KEY=AQ....your_key
# Get a free key at https://aistudio.google.com/

10. Start the hub

python api/server.py

Open http://localhost:8000 in Chrome or Edge.

✓ You're ready If you see the Physical AI Lab hub in Chrome or Edge, setup is complete. You're ready to start.
Next time you sit down You only do the pip installs once. For any future session just:
.venv\Scripts\activate
python api/server.py

If setup is done, two commands get you running:

# Option A — terminal (recommended)
.venv\Scripts\activate
python api/server.py

# Option B — double-click setup.bat again.
# It detects the .venv and skips straight to launching the server.

Open http://localhost:8000 in Chrome or Edge. That's the hub — everything runs from there.

What happens in each module

ModuleWhat you buildWhat you'll see
0 — KickoffThe pipeline diagram. Print your first state vector.Four numbers. That's the whole robot brain, right now.
1 — PerceptionWebcam → 21 landmarks → 4 joint anglesGreen dots on your hand in real time. Angles printing as you move.
2 — SimulationStep CartPole and Reacher environmentsThe 11 numbers Reacher sees. The 2 torques you'll control in M4.
3 — Reinforcement LearningTrain a PPO agent on CartPole from scratchFlat reward curve → sharp climb. The agent discovers balance around 20–30k steps. Don't talk over it.
4 — Perception → ActionWire your hand to the robot arm. One line of code.Move your finger. The Reacher arm follows. The loop is closed.
5 — Foundation ModelsReplace your hand with Gemini as the controllerCamera frame goes in. JSON action comes back. Same pattern as RT-2.
6 — Wrap-upMap everything to real research toolsMuJoCo, SB3, MediaPipe — not toys. What comes next.

The exercises

Every module has an exercise.py with a # TODO START / END block — usually 3–5 lines, 10–15 minutes each. A # SOLUTION block at the bottom can be uncommented if you get stuck. Open it in VS Code alongside the browser.

ModuleWhat the exercise asks
M0Print a numpy state vector — np.array([145.2, 163.8, 171.4, 158.0], dtype=np.float32)
M1Add the ring finger angle (landmarks 13→14) to make a 4-element vector
M2Print observation_space.low and .high for Reacher — understand the bounds
M3Change total_timesteps and re-run. Watch the curve shape change.
M4Add landmark 4 (thumb tip) as a third torque channel via ActionSliceWrapper
M5Write your own MY_PROMPT. Watch how phrasing changes the model's output.

The notebooks

Open these in VS Code — File → Open Folder → select the repo, then pick the Physical AI Lab kernel top-right.

NotebookWhen to open it
modules/00_kickoff/overview.ipynbFirst thing — run all cells, draws the full pipeline
modules/03_rl/01_mdp_concepts.ipynbM3 — MDP concepts, run alongside the training script
modules/06_wrapup/concepts_map.ipynbEnd — maps every module to real-world equivalents
Heads up The lab was built and tested on Windows 11. Mac and Linux work for most of it, but if something breaks the Windows instructions are your better reference.

Automated setup

There's a setup.sh that mirrors the Windows script. It needs Python 3.12 already installed:

bash setup.sh

If Python 3.12 isn't on your machine yet:

# Homebrew first, if you don't have it
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

brew install python@3.12
python3.12 --version   # should print 3.12.x
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.12 python3.12-venv python3.12-dev
python3.12 --version

Manual steps

Same as the Manual Setup tab, with two differences:

# Create and activate the venv
python3.12 -m venv .venv
source .venv/bin/activate   # ← not .venv\Scripts\activate

# Everything else is identical
pip install torch==2.14.0+cpu --index-url https://download.pytorch.org/whl/cpu
# If that exact version isn't available yet, omit the ==2.14.0+cpu pin:
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install -r requirements.txt
python download_model.py
python verify_install.py
python api/server.py
On subsequent days You don't need to redo the pip installs. Use start_hub.sh instead:
bash start_hub.sh
Or manually: source .venv/bin/activate && python api/server.py

A few things worth knowing

TopicNotes
MuJoCoPip wheels exist for macOS (arm64 + x86_64) and Linux x86-64. Installs without issues.
PyTorch on Apple SiliconThe CPU wheel works fine. For faster Module 3 training you can skip the --index-url flag and get the native MPS build instead — entirely optional.
OpenGL on LinuxIf you're on a headless server, make_env automatically falls back from human rendering to rgb_array to None. Nothing to configure.
MediaPipeWheels exist for macOS arm64/x86_64 and Linux x86_64. Linux aarch64 is not covered.
Webcam on LinuxAdd yourself to the video group if Chrome can't access the camera: sudo usermod -aG video $USER, then log out and back in.
BrowserChrome or Edge required on all platforms. SharedArrayBuffer (needed by MediaPipe WASM) isn't available in Firefox.

Apple Silicon tip

No Rosetta needed PyTorch, MuJoCo, MediaPipe, and OpenCV all ship native arm64 wheels. Just run pip install as normal — pip picks the right one automatically.

Most issues fall into one of these categories. If none of these help, open an issue on the GitHub repository with the exact error message.

Setup

The setup.bat window opens and immediately disappears

Right-click setup.bat → Open (instead of double-clicking) to keep the window visible. Or run it from a terminal:

cd C:\path\to\physical-ai-lab
.\setup.bat

Stops at "Locating Python 3.12" without doing anything else

Python 3.12 couldn't be found or downloaded. Check your connection, then install it manually from python.org — tick Add Python to PATH during setup — then re-run setup.bat.

PyTorch takes forever or times out

The CPU wheel is about 200 MB. If pip times out, run it manually in a terminal with the venv active:

.venv\Scripts\activate
pip install torch==2.14.0+cpu --index-url https://download.pytorch.org/whl/cpu

[FAIL] mujoco in the verify output

ARM64 Windows (Surface Pro X, Snapdragon): MuJoCo doesn't have an ARM64 Windows wheel. Run everything inside WSL2:

# PowerShell, as Administrator
wsl --install
# Restart, open Ubuntu, then run: bash setup.sh

Regular x86-64 Windows: Usually a missing C++ runtime. Install it:

winget install Microsoft.VCRedist.2015+.x64

Hub / browser

Hub page is blank or MediaPipe won't load

You need Chrome or Edge. Firefox and Safari don't support SharedArrayBuffer, which MediaPipe's WASM inference requires. Switch browsers and try again.

Port 8000 is already in use

# Find who's using it
netstat -ano | findstr :8000

# Kill it (replace 12345 with the PID in the last column)
taskkill /PID 12345 /F

python api/server.py

VS Code / Jupyter

VS Code is using the wrong Python kernel

Click the kernel name in the top-right of any notebook → Python Environments… → pick Physical AI Lab. If it's not there, re-register it:

.venv\Scripts\activate
python -m ipykernel install --user --name physical-ai --display-name "Physical AI Lab"

Module 5 / Gemini

Gemini calls fail or return errors

Check .env exists in the repo root and has a valid key. Module 5 falls back to cached responses automatically if the key is missing — the lab works either way.

type .env   # should show GEMINI_API_KEY=AQ....