← Back to Lab 5

Lab 5 · Setup

Get it running, step by step

Seven steps from an empty terminal to a notebook running on your own laptop. Do them in order, and don’t skip a ✅ check: if it doesn’t match, use the fix underneath before you move on. Pick Mac or Windows on any terminal box; the whole page follows.

Green sticky up at every ✅. Red sticky if a check fails and the fix doesn’t help — that is what we are here for.
  1. 1Open a terminal and check uv

    Mac: Terminal (⌘ Space, type Terminal). Windows: PowerShell (Start menu, type PowerShell). You installed uv in Lab 2.

    Terminal
    you@mac ~ %uv --version
    uv 0.13.7 (…)
    ✅ A version number appears.

    Didn’t work?

    • command not found — close the terminal and open a new one. Still missing? Re-run the uv installer from Lab 2.
  2. 2Bring uv up to date

    Newer uv, fewer surprises.

    Terminal
    you@mac ~ %uv self update
    success: You’re already on version v0.13.7 of uv (the latest version).
    ✅ It says success — either upgraded or already the latest.

    Didn’t work?

    • An error saying self-update is not available means uv was installed another way (Homebrew, winget). That is fine: skip this step.
  3. 3Install uv-start — once per computer

    uv-start is a tool for the whole computer, so it is installed once with uv tool install. Packages like numpy go into each project instead.

    Terminal
    you@mac ~ %uv tool install uv-start
    Installed 1 executable: uv-start
    you@mac ~ %uv-start --help
    Usage: uv-start [OPTIONS] [PROJECT_NAME]
    ✅ uv-start --help prints the usage.

    Didn’t work?

    • uv-start: command not found — run uv tool update-shell, close the terminal, open a new one, try again.
    • uv-start is already installed — fine, you did this yesterday. Run uv tool upgrade uv-start to get the latest version.
  4. 4Make the project

    Go to your home folder first, so you know where the project ends up. This takes a minute: it downloads Python, numpy, pandas and matplotlib into the project.

    Terminal
    you@mac ~ %cd ~
    you@mac ~ %uv-start lab5-neurons --data
    …
    Data project template files copied successfully.
    ✅ The last line says Data project template files copied successfully.

    Didn’t work?

    • Directory already exists — you made it yesterday. Use it: carry on with step 5. Or start fresh with a new name, e.g. uv-start lab5-neurons-2 --data, and use that name from here on.
  5. 5Get this week’s notebooks

    Move into the project, download the notebooks and the two neuron recordings, and unpack them. On Windows it is curl.exe, with the .exe.

    Terminal
    you@mac ~ %cd lab5-neurons
    you@mac ~ %curl -O https://python-for-biologists.vercel.app/data/lab5/lab5.zip
    you@mac ~ %tar -xf lab5.zip
    you@mac ~ %ls
    01_numpy_small_data.ipynb 02_neuron_analysis_advanced.ipynb 02_neuron_analysis_basics.ipynb
    data lab5.zip pyproject.toml README.md results sample.ipynb uv.lock
    ✅ Three notebooks starting 01_ and 02_, and a data folder.

    Didn’t work?

    • PowerShell: parameter name 'O' — you typed curl; type curl.exe.
    • Still stuck? Download lab5.zip in the browser, unzip it, and move the three notebooks and the data folder into lab5-neurons (in your home folder).
  6. 6Open the project in VS Code

    Open the folder, not a single file — that is how VS Code finds the project’s Python.

    Terminal
    you@mac ~ %code .
    ✅ VS Code opens with the notebooks in the Explorer on the left. Answer Yes to “Do you trust the authors?” and Install to the recommended extensions (Python, Jupyter, Ruff).

    Didn’t work?

    • code: command not found — open VS Code yourself: File → Open Folder → lab5-neurons in your home folder.
    • Missed the extensions pop-up? Extensions (⇧⌘X / Ctrl+Shift+X) → search Jupyter → Install.
  7. 7Pick the kernel and run the first cell

    Open 01_numpy_small_data.ipynb. Top right: Select Kernel → Python Environments → .venv. Click into the first code cell and press Shift+Enter.

    ✅ The cell prints frame: [ 0 1 2 … and the top right of the notebook shows .venv. You are running locally. 🎉

    Didn’t work?

    • It asks to install ipykernel, or says No module named 'numpy' — wrong kernel. Select Kernel again and pick .venv. Never pip install.
    • No .venv in the list — check you opened the folder (step 6). Then, in VS Code’s terminal, run uv sync and Developer: Reload Window (⇧⌘P / Ctrl+Shift+P).

You’re set up — now the lab

Work through 01_numpy_small_data.ipynb top to bottom, then choose 02_neuron_analysis_basics.ipynb or 02_neuron_analysis_advanced.ipynb — pick .venv as the kernel in each new notebook. Want the why behind each step? The session slides explain it.