Installation#

PyBaMM is available on GNU/Linux, MacOS and Windows. It can be installed using pip or conda, or from source.

PyBaMM can be installed via pip from PyPI.

pip install pybamm

PyBaMM is part of the Anaconda distribution and is available as a conda package through the conda-forge channel.

conda install -c conda-forge pybamm

PyBaMM can be installed via pip from PyPI.

pip install pybamm

PyBaMM is part of the Anaconda distribution and is available as a conda package through the conda-forge channel.

conda install -c conda-forge pybamm

Optional solvers#

Following GNU/Linux and macOS solvers are optionally available:

Dependencies#

Required dependencies#

PyBaMM requires the following dependencies.

Package

Minimum supported version

NumPy

1.23.5

SciPy

1.9.3

CasADi

3.6.3

Xarray

2022.6.0

Anytree

2.8.0

SymPy

1.9.3

typing-extensions

4.10.0

pandas

1.5.0

Optional Dependencies#

PyBaMM has a number of optional dependencies for different functionalities. If the optional dependency is not installed, PyBaMM will raise an ImportError when the method requiring that dependency is called.

If you are using pip, optional PyBaMM dependencies can be installed or managed in a file (e.g., setup.py, or pyproject.toml) as optional extras (e.g.,``pybamm[dev,plot]``). All optional dependencies can be installed with pybamm[all], and specific sets of dependencies are listed in the sections below.

Plot dependencies#

Installable with pip install "pybamm[plot]"

Dependency

Minimum Version

pip extra

Notes

imageio

2.3.0

plot

For generating simulation GIFs.

matplotlib

3.6.0

plot

To plot various battery models, and analyzing battery performance.

Docs dependencies#

Installable with pip install "pybamm[docs]"

Dependency

Minimum Version

pip extra

Notes

sphinx

-

docs

Sphinx makes it easy to create intelligent and beautiful documentation.

pydata-sphinx-theme

-

docs

A clean, Bootstrap-based Sphinx theme.

sphinx_design

-

docs

A sphinx extension for designing.

sphinx-copybutton

-

docs

To copy codeblocks.

myst-parser

-

docs

For technical & scientific documentation.

sphinx-inline-tabs

-

docs

Add inline tabbed content to your Sphinx documentation.

sphinxcontrib-bibtex

-

docs

For BibTeX citations.

sphinx-autobuild

-

docs

For re-building docs once triggered.

Examples dependencies#

Installable with pip install "pybamm[examples]"

Dependency

Minimum Version

pip extra

Notes

jupyter

-

examples

For example notebooks rendering.

Dev dependencies#

Installable with pip install "pybamm[dev]"

Dependency

Minimum Version

pip extra

Notes

pre-commit

-

dev

For managing and maintaining multi-language pre-commit hooks.

ruff

-

dev

For code formatting.

nox

-

dev

For running testing sessions in multiple environments.

coverage

-

dev

For calculating coverage of tests.

parameterized

-

dev

For test parameterization.

pytest

6.0.0

dev

For running Jupyter notebooks tests.

pytest-xdist

-

dev

For running tests in parallel across distributed workers.

nbmake

-

dev

A pytest plugin for executing Jupyter notebooks.

Cite dependencies#

Installable with pip install "pybamm[cite]"

Dependency

Minimum Version

pip extra

Notes

pybtex

0.24.0

cite

BibTeX-compatible bibliography processor.

bpx dependencies#

Installable with pip install "pybamm[bpx]"

Dependency

Minimum Version

pip extra

Notes

bpx

-

bpx

Battery Parameter eXchange

tqdm dependencies#

Installable with pip install "pybamm[tqdm]"

Dependency

Minimum Version

pip extra

Notes

tqdm

-

tqdm

For logging loops.

Jax dependencies#

Installable with pip install "pybamm[jax]", currently supported on Python 3.9-3.11.

Dependency

Minimum Version

pip extra

Notes

JAX

0.4.20

jax

For the JAX solver

jaxlib

0.4.20

jax

Support library for JAX

odes dependencies#

Installable with pip install "pybamm[odes]"

Dependency

Minimum Version

pip extra

Notes

scikits.odes

-

odes

For scikits ODE & DAE solvers

Note

Before running pip install "pybamm[odes]", make sure to install scikits.odes build-time requirements as described here .

Full installation guide#

Installing a specific version? Installing from source? Check the advanced installation pages below