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.

Python Setup

Updated: 22 Oct 2026

The tutorials can be run in two ways:

You need two things: pixi, a small program that installs Python and all the required packages for you, and the tutorial folder, which tells pixi exactly what to install. If you already have another Python installation (for example Anaconda), it will not interfere. Use the terminal as described below rather than the Anaconda Prompt.

Part 1: Installation (once)

Step 1: Install pixi

Windows
macOS / Linux

Open the Start menu, type terminal and open Terminal. This is a window into which you type commands.

Copy the line below, paste it into the terminal, and press Enter:

powershell -ExecutionPolicy ByPass -c "irm -useb https://pixi.sh/install.ps1 | iex"

Then close the terminal and open a new one. Check that pixi is installed and working by typing:

pixi --version

It should print a version number. See the pixi documentation if you run into problems.

Step 2: Download the notebooks folder

The notebooks are in the notebooks folder of the repository. GitHub cannot download a single folder as a ZIP file, so use the download-directory tool, which creates a ZIP file of the folder. Unzip it and move the resulting notebooks folder somewhere you will keep your work, for example Documents.

Step 3: Install the packages

Open a terminal from the notebooks folder (the folder that contains pixi.toml) and type:

pixi install

The first time, pixi downloads Python and all the packages. This can take several minutes and may look like nothing is happening. Wait until the command finishes. Later, starting is instant.

Part 2: Running the tutorials (every time)

  1. Open a terminal in the notebooks folder (the folder that contains pixi.toml).

  2. Start JupyterLab:

    pixi run editor
  3. JupyterLab opens in your browser. Double-click a tutorial in the file browser on the left, for example Tuto_floris.ipynb.

  4. Run code cells by pressing Shift+Enter or click the ▶ button in the toolbar. Cells should be run from top to bottom.

  5. When you are done, save your work, close the browser tab, and press Ctrl+C in the terminal.

Working with a notebook

A notebook is made of cells, which contain either text or code.

Troubleshooting

ProblemSolution
pixi is not recognized / command not foundYou did not open a fresh terminal after Step 1. Close the terminal and open a new one.
pixi says it cannot find a pixi.toml or workspaceYou are in the wrong folder. Open the terminal in the folder that directly contains pixi.toml (see Step 2).
A tutorial shows ModuleNotFoundErrorYou started JupyterLab in another way. Close it and start it with pixi run editor from the notebooks folder.

Acknowledgments

This page is adapted from the Installing Python appendix of the TU Delft course Modelling energy systems by Stefan Pfenninger and contributors.