Registry / data / pybamm

pybamm

JSON →
library26.4.2pypypi✓ verified 86d ago

Python Battery Mathematical Modelling (PyBaMM) is an open-source battery simulation package written in Python, currently at version 26.4.2. It provides a framework for building and solving continuum models for batteries, with support for experimental protocols and parameter estimation. PyBaMM releases on a monthly cadence.

pip install pybamm
INSTALL
IMPORT
SIG · PYBAMM
P
pybamm
datapythonv26.4.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pybamm
import pybamm
The top-level module is imported as a namespace.
Simulation
from pybamm import Simulation
Simulation is the main class for running experiments. In v26.4.0+, Simulation was refactored into BaseSimulation and Simulation; Simulation is still the recommended import.
model
pybamm.lithium_ion.SPM()
pybamm.SPM()
Models are accessed via submodules like pybamm.lithium_ion, not directly on pybamm.

Basic usage: import pybamm, choose a model, create a Simulation, solve, and plot.

import pybamm # Create a model model = pybamm.lithium_ion.SPM() # Create a simulation sim = pybamm.Simulation(model) # Solve solution = sim.solve() # Plot solution.plot()
pybamm --version
Debug
Known issues
breakingIn v26.4.0, Simulation was split into BaseSimulation and Simulation. Custom subclasses of Simulation may break if they relied on internal methods that moved to BaseSimulation.
fix
If you have custom subclasses, inherit from BaseSimulation instead, or override as needed.
affects: >=26.4.0
gotchaEISSimulation.solve(initial_soc=..., inputs=...) does not forward inputs to build pre-v26.4.2. This was fixed in v26.4.2.
fix
Upgrade to v26.4.2 or later, or manually set inputs before calling solve.
affects: >=26.0.0,<26.4.2
deprecatedThe 'pybamm.get_parameters_collections' function is deprecated and will be removed in a future release. Use 'pybamm.ParameterValues' directly.
fix
Replace calls to pybamm.get_parameters_collections with pybamm.ParameterValues.create_from_... methods.
affects: >=25.0.0
gotchaSerialise.load_custom_model may silently fall back to pybamm.BaseModel if the saved base class cannot be imported. This was fixed in v26.4.2 to walk the recorded MRO.
fix
Upgrade to v26.4.2 or later to avoid silent fallback.
affects: >=26.0.0,<26.4.2
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pybamm'
PyBaMM is not installed.
fix
Run 'pip install pybamm' in your environment.
ValueError: Expected solver to be 'casadi' or 'scikits.odes', got ...
Unsupported solver specified.
fix
Use one of the supported solvers: 'casadi', 'scikits.odes', or leave default.
pybamm.ModelError: Assigning a variable/parameter that does not exist in the model
Trying to set a parameter or variable that is not part of the selected model.
fix
Check the model's parameter list using model.parameters or model.variables.
pybamm.SolverError: Could not find valid consistent initial conditions
The model's initial conditions are inconsistent or missing.
fix
Manually set initial conditions via model.set_initial_conditions or use a model with known consistent defaults.
Upgrade
Version history
26.4.2latest on PyPI · released May 5, 2026
Audit
Dependencies
casadirequiredDefault solver backend; must be installed for simulation to work
scikits.odesoptionalOptional solver backend for stiff ODEs/DAEs
jaxoptionalUsed for automatic differentiation and optional solver acceleration
Agent activity
6 hits · last 30 days
node
6
Resources
pybamm — pip install pybamm · libregistry