Windows#

Prerequisites#

To use PyBaMM, you must have Python 3.9, 3.10, 3.11, or 3.12 installed.

To install Python 3 download the installation files from Python’s website. Make sure to tick the box on Add Python 3.X to PATH. For more detailed instructions please see the official Python on Windows guide.

Install PyBaMM#

User install#

Launch the Command Prompt and go to the directory where you want to install PyBaMM. You can find a reminder of how to navigate the terminal here.

We recommend to install PyBaMM within a virtual environment, in order not to alter any distribution python files.

To install virtualenv, type:

python -m pip install virtualenv

To create a virtual environment env within your current directory type:

python -m virtualenv env

You can then “activate” the environment using:

env\Scripts\activate.bat

Now all the calls to pip described below will install PyBaMM and its dependencies into the environment env. When you are ready to exit the environment and go back to your original system, just type:

deactivate

PyBaMM can be installed via pip:

pip install pybamm

PyBaMM’s dependencies (such as numpy, scipy, etc) will be installed automatically when you install PyBaMM using pip.

For an introduction to virtual environments, see (https://realpython.com/python-virtual-environments-a-primer/).

Optional - JaxSolver#

Users can install jax and jaxlib to use the Jax solver.

pip install "pybamm[jax]"

The pip install "pybamm[jax]" command automatically downloads and installs pybamm and the compatible versions of jax and jaxlib on your system.

Uninstall PyBaMM#

PyBaMM can be uninstalled by running

pip uninstall pybamm

in your virtual environment.

Installation using WSL#

If you want to install the optional PyBaMM solvers, you have to use the Windows Subsystem for Linux (WSL). You can find the installation instructions here.