GNU-Linux & MacOS#


To use and/or contribute to PyBaMM, you must have Python 3.8, 3.9, 3.10, or 3.11 installed.

To install Python 3 on Debian-based distributions (Debian, Ubuntu, Linux Mint), open a terminal and run

sudo apt update
sudo apt install python3

On Fedora or CentOS, you can use DNF or Yum. For example

sudo dnf install python3

On macOS, you can use the homebrew package manager. First, install brew:

ruby -e "$(curl -fsSL"

then follow instructions in the link on adding brew to path, and run

brew install python3

Install PyBaMM#

User install#

We recommend to install PyBaMM within a virtual environment, in order not to alter any distribution Python files. First, make sure you are using Python 3.8, 3.9, 3.10, or 3.11. To create a virtual environment env within your current directory type:

virtualenv env

You can then “activate” the environment using:

source env/bin/activate

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:


PyBaMM can be installed via pip. On macOS, it is necessary to install the SUNDIALS library beforehand.

In a terminal, run the following command:

pip install pybamm

In a terminal, run the following commands:

brew install sundials
pip install pybamm

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

For an introduction to virtual environments, see (

Optional - scikits.odes solver#

Users can install scikits.odes in order to use the wrapped SUNDIALS ODE and DAE solvers. Currently, only GNU/Linux and macOS are supported.

In a terminal, run the following commands:

apt install libopenblas-dev

The pybamm_install_odes command is installed with PyBaMM. It automatically downloads and installs the SUNDIALS library on your system (under ~/.local), before installing scikits.odes. (Alternatively, one can install SUNDIALS without this script and run pip install pybamm[odes] to install pybamm with scikits.odes.)

In a terminal, run the following command:

pip install scikits.odes

Assuming that SUNDIALS was installed as described above.

Optional - JaxSolver#

Users can install jax and jaxlib to use the Jax solver. Currently, only GNU/Linux and macOS are supported.

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. (pybamm_install_jax is deprecated.)

Uninstall PyBaMM#

PyBaMM can be uninstalled by running

pip uninstall pybamm

in your virtual environment.