pybamm
Python Battery Mathematical Modelling
What it is and what it does
PyBaMM (Python Battery Mathematical Modelling) is an open-source framework for simulating battery electrochemistry by solving differential equations. It combines a general-purpose solver framework with a library of pre-built battery models (such as the Doyle-Fuller-Newman model), parameter sets, and experiment definitions. Users can run simple constant-current discharge simulations with default settings or define complex multi-step experiments (discharge, rest, charge cycles) with custom physics, geometry, discretization methods, and solver parameters.
The package is designed for battery research and development, enabling exploration of how design choices and modeling assumptions affect performance under different operating scenarios. It depends on scientific Python libraries (numpy, scipy, sympy, pandas, xarray) for computation and visualization, and includes optional support for JAX-based solvers. The project is actively maintained, fiscally sponsored by NumFOCUS, and follows a CalVer versioning scheme with documented breaking-change policies.
Use it for:
- Simulate constant-current discharge profiles for lithium-ion cells to predict capacity and voltage curves.
- Model complex multi-step charge/discharge experiments (e.g., CCCV charging) to validate battery management strategies.
- Explore the effect of parameter changes (electrode thickness, porosity, conductivity) on battery performance without physical prototyping.
- Develop and test custom battery models by writing differential equations within the PyBaMM framework.
- Generate publication-ready plots and data exports for battery performance analysis and research papers.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
PyBaMM is a Python framework for simulating battery behavior by solving systems of differential equations, providing pre-built battery models, parameters, and tools for running battery-specific experiments and visualizing results.
Yes. PyBaMM is a mature, actively maintained framework (Production/Stable status, recent release) with low installation friction, permissive licensing, and no known vulnerabilities. Install it if you need to simulate battery electrochemistry, validate battery designs computationally, or conduct battery modeling research. The large dependency tree (13 runtime packages) is standard for scientific Python and poses no unusual risk.
Install
pybamm on PyPI
pip
pip install pybammuv
uv add pybammpoetry
poetry add pybammInstalling pybamm
Before you install
Low friction installation via pip or conda-forge. Active maintenance with a recent release (23 days ago) and ongoing repository activity. Supports modern Python versions (3.10–3.14) and has 13 runtime dependencies including standard scientific libraries.
License in practice
BSD license (permissive). You may use, modify, and distribute PyBaMM freely in proprietary or open-source projects, provided you retain the copyright notice and disclaimer.
Quickstart
pip install pybamm
import pybamm
model = pybamm.lithium_ion.DFN()
sim = pybamm.Simulation(model)
sim.solve([0, 3600])
sim.plot()
Verify before relying
- Whether the package requires external solvers (e.g., CasADi) to be installed separately for full functionality.
- Performance characteristics and scalability limits for large-scale battery simulations.
- Availability and maturity of optional JAX-based solver on Python 3.11+.
Package facts
| License | Copyright (c) 2018, the PyBaMM team. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (<3.15,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 13 — anytree, black, numpy, pandas, platformdirs, pooch, posthog, pybammsolvers, pyyaml, scipy, sympy, typing-extensions, xarray |
| Maintenance | actively maintained — 23 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 106,144/month — #12,667 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pybamm-26.7.1.0-py3-none-any.whl
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
pybammsolverspybammsolvers provides a Python interface to…
unclear · top 15,000 on PyPI
pyomoPyomo is a Python framework for formulating and…
permissive · top 5,000 on PyPI
pyamgPyAMG provides Algebraic Multigrid (AMG)…
permissive · top 15,000 on PyPI
simpySimPy is a process-based discrete-event…
permissive · top 15,000 on PyPI
OpenMMOpenMM is a Python wrapper for a C++ molecular…
permissive · top 15,000 on PyPI
pvlibSimulates photovoltaic energy system…
permissive · top 5,000 on PyPI
pandapowerpandapower automates power system modeling,…
permissive · top 15,000 on PyPI
NREL-PySAMPySAM wraps NREL's System Advisor Model (SAM)…
permissive · top 15,000 on PyPI
aiobmsbleAsynchronous Python library for querying…
permissive · top 15,000 on PyPI
salabimSalabim is a Python library for discrete event…
permissive · top 15,000 on PyPI