Skip to main content
PyBaMM is available on GNU/Linux, macOS, and Windows. It requires Python 3.10–3.14.

Install PyBaMM

pip install pybamm
All required dependencies (NumPy, SciPy, CasADi, etc.) are installed automatically.

Set up a virtual environment

We strongly recommend installing PyBaMM inside a virtual environment so that it does not alter your system Python files.
1

Create a virtual environment

Run the following command in the directory where you want to work:
virtualenv env
2

Activate the environment

source env/bin/activate
3

Install PyBaMM

pip install pybamm
4

Deactivate when done

deactivate
For a primer on Python virtual environments, see Real Python — Python Virtual Environments.

Optional dependencies

You can install PyBaMM with optional extras depending on your use case:
ExtraWhat it addsInstall command
plotMatplotlib-based plotting via sim.plot()pip install "pybamm[plot]"
citeCitation management via pybamm.print_citations()pip install "pybamm[cite]"
bpxBattery Parameter eXchange format supportpip install "pybamm[bpx]"
jaxJAX-based solver (see restrictions below)pip install "pybamm[jax]"
allAll of the above except JAXpip install "pybamm[all]"

Optional — JAX solver

Install jax and jaxlib to use the JAX-based solver:
pip install "pybamm[jax]"
This automatically installs compatible versions of jax and jaxlib alongside PyBaMM.
The JAX solver requires Python 3.11 or later and is not supported on macOS with an x86_64 (Intel) processor. It works on Linux (x86_64 and ARM), macOS (Apple Silicon), and Windows.
The full conda-forge pybamm package includes jax and jaxlib by default.

Docker

A Dockerfile is available in the PyBaMM repository for containerised environments.

Uninstall

pip uninstall pybamm

Build docs developers (and LLMs) love