Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Before Module 1, you install three things: Python, which runs your programs; Visual Studio Code (VS Code), an editor for writing them; and JupyterLab, which runs the course’s lab notebooks in your web browser. Plan about an hour and a half. Everything here is free.

You type a few commands along the way. A command is a line of text that you type into a terminal, a window where you give the computer instructions by typing instead of clicking. You don’t need to understand the commands yet: Module 9 explains the terminal properly. Type or paste each command exactly as shown, press Enter, and compare what happens with what the step says.

Each step gives the commands for Windows, where the terminal runs a program called PowerShell, and for macOS and Linux, where it runs a program called a shell. Follow the ones for your computer.

These steps follow the official instructions from python.org, VS Code, and Git. The course’s own checks run on Linux, so if a step on Windows or macOS doesn’t do what this page says, see Troubleshooting, and report the problem on the course’s GitHub repository.

1. Make a folder for the course

Make a folder named py101 where you keep your documents, for example in your Documents folder. Everything for the course goes in it: the labs you download, the virtual environment you create in step 6, and later your projects.

Use a folder name without spaces. Spaces in folder names make some terminal commands harder to type.

2. Install Python

The course needs Python 3.12 or newer. Install the newest release.

Windows. python.org offers the Python install manager, which installs Python and keeps it up to date.

  1. Go to https://www.python.org/downloads/, and download the install manager. It is also in the Microsoft Store app as “Python install manager”; the two are the same.

  2. Open the file you downloaded and select Install.

  3. Open a terminal: click Start, type PowerShell, and open Windows PowerShell.

  4. Type python and press Enter. The first time, the install manager downloads and installs the newest Python, which takes a minute or two. If it asks whether to add a folder to your PATH (the list of folders where Windows looks for programs), answer yes.

  5. When you see the >>> prompt, Python is running. Type exit() and press Enter to leave it.

macOS.

  1. Go to https://www.python.org/downloads/, and download the newest release for macOS. The file’s name ends in .pkg.

  2. Open it and follow the installer’s steps.

  3. When it finishes, a Finder window opens on the Python 3.15 folder in Applications (the number matches the version you installed). Double-click Install Certificates.command in it. A Terminal window opens and installs the security certificates that Python uses to download from websites; the course needs them in Module 17. It’s done when it prints update complete.

On macOS, the command for Python is python3. macOS includes its own copy of Python for its own tools; leave that copy alone, and use the one you installed.

Linux. Most distributions include Python 3. Open a terminal and check the version:

python3 --version

If it prints Python 3.12 or a higher number, you have what you need. On Debian and Ubuntu, also install the package that creates virtual environments (step 6), which asks for your password:

sudo apt install python3-venv

If your Python is older than 3.12, install a newer one with your distribution’s package manager.

3. Install VS Code

  1. Go to https://code.visualstudio.com/, download VS Code for your computer, and install it.

  2. Open VS Code. Select the Extensions icon in the bar on the left (four small squares), search for Python, and install the extension named Python whose publisher is Microsoft. It lets VS Code run and check Python code.

  3. Turn off the AI features for now. The course’s policy on AI tools asks you to write your own code until Module 14, and AI code completion would write it for you. Open the settings with File > Preferences > Settings (on macOS, Code > Settings > Settings), search for chat.disableAIFeatures, and tick its box. VS Code’s documentation describes this setting as disabling and hiding the built-in AI features, such as chat and inline suggestions. You can turn them back on in Module 14.

4. Open your course folder in VS Code

  1. In VS Code, choose File > Open Folder, and select the py101 folder you made in step 1. If VS Code asks whether you trust the authors of the files in this folder, answer yes: you are the author.

  2. Open a terminal inside VS Code with Terminal > New Terminal. A panel opens at the bottom of the window. Its terminal starts in your py101 folder, which is where the next commands must run.

5. Check Python

In the terminal in VS Code, ask Python for its version.

Windows:

python --version

macOS and Linux:

python3 --version

It prints a line such as Python 3.15.2. Any version from 3.12 up is fine. If you see an error instead, see Troubleshooting.

6. Create a virtual environment

A virtual environment is a folder that holds one copy of Python and the extra packages one project needs, kept apart from the rest of your computer. Packages you install into it can’t break anything else, and you can delete the folder and start again at any time. The course’s environment is a folder named .venv inside py101.

Windows:

python -m venv .venv

macOS and Linux:

python3 -m venv .venv

The command prints nothing when it works, and a folder named .venv appears in VS Code’s Explorer on the left. (Names that start with a dot are hidden in some file browsers, but VS Code shows them.)

7. Install the course’s packages

Install JupyterLab, pytest (a tool for testing code, from Module 13), and matplotlib (which draws charts) into the environment. The == pins each package to the version the course was checked with.

Windows:

.venv\Scripts\python -m pip install jupyterlab==4.6.6 pytest==9.2.0 matplotlib==3.11.2

macOS and Linux:

.venv/bin/python -m pip install jupyterlab==4.6.6 pytest==9.2.0 matplotlib==3.11.2

pip is Python’s package installer. The command downloads the packages, and the packages they depend on, which takes a few minutes. It ends with a long line that starts with Successfully installed.

The command starts with the path to the environment’s own Python (.venv\Scripts\python or .venv/bin/python), so the packages go into the environment and nowhere else. The course always runs the environment’s programs this way.

8. Run your first lab

  1. Start JupyterLab from the terminal in VS Code.

    Windows:

    .venv\Scripts\jupyter lab

    macOS and Linux:

    .venv/bin/jupyter lab

    JupyterLab opens in your web browser. The terminal keeps printing messages while it runs; leave it open.

  2. Go to Lab 1 on the course website. Open the Downloads menu at the top of the page, and choose Download as ipynb. Save the file in your py101 folder. (If your browser saves it with letters and numbers added to its name, rename it lab01.ipynb.)

  3. In JupyterLab, the file browser on the left shows your py101 folder. Double-click lab01.ipynb to open it.

  4. Click in the first code cell, the one under “Setup”, and press Shift+Enter to run it. It prints the version of Python that runs the lab, which is your environment’s Python.

You’re set up. Continue with Module 1, which explains what you just did.

Every time you come back

  1. Open VS Code. It reopens your py101 folder; if it doesn’t, use File > Open Folder.

  2. Open a terminal with Terminal > New Terminal, and start JupyterLab with the command from step 8.

  3. Download each new lab into your py101 folder, and open it in JupyterLab.

When you finish, choose File > Shut Down in JupyterLab, which stops JupyterLab, and close its browser tab.

Before Module 10: Git and a GitHub account

Module 10 teaches Git, a tool that records the history of a project, and GitHub, a website that stores Git projects and shows them to others. You don’t need them until then.

  1. Install Git, from https://git-scm.com/install/.

    • Windows: download and run the Git for Windows installer; its default choices are fine.

    • macOS: run xcode-select --install in Terminal, which installs Apple’s command line tools, Git among them, or use one of the other ways that page lists.

    • Linux: install the git package with your distribution’s package manager; on Debian and Ubuntu, sudo apt install git.

  2. Create a free account at https://github.com/. Choose a username you are happy to show an employer: it appears in the address of every project you publish.

  3. In GitHub’s email settings, select Keep my email address private. GitHub then gives you a noreply address to use in Git, so your email address isn’t published with your work. Module 10 shows where it goes.

Before Module 18: Ruff and mypy

Module 18 adds two tools that check code: Ruff, which finds common mistakes and formats code, and mypy, which checks type hints. Install them into the same environment when you reach it.

Windows:

.venv\Scripts\python -m pip install ruff==0.17.6 mypy==2.4.1

macOS and Linux:

.venv/bin/python -m pip install ruff==0.17.6 mypy==2.4.1

Troubleshooting

What happensWhat to do
Windows: typing python opens the Microsoft Store, or says it isn’t recognizedClose the terminal and open a new one, because a terminal reads the list of program folders only when it starts. If that doesn’t help, click Start, open Manage app execution aliases, and check that the aliases for Python (default) are turned on.
macOS: python3 --version prints an older version than the one you installedThe terminal found Apple’s copy of Python first. Close the terminal, open a new one, and try again; if it still prints the old version, use the full name, such as python3.15, in every command.
Linux: python3 -m venv .venv says ensurepip is not availableInstall the python3-venv package (step 2), delete the half-made .venv folder, and run the command again.
No such file or directory or is not recognized, naming .venvThe terminal isn’t in your py101 folder. Open the folder in VS Code (step 4), open a new terminal, and run the command again.
pip says it can’t find a version of a packageYour Python is older than 3.12. Check the version (step 5), and install a newer Python (step 2).
The lab’s setup cell prints a Python version older than 3.12JupyterLab is running a different Python. Stop JupyterLab, and start it again with the exact command from step 8.
Windows: a guide elsewhere tells you to run Activate.ps1 and PowerShell refusesYou don’t need to activate the environment in this course: run its programs by their path, as these steps do.