Installation¶
sbmlsim needs python 3.14 or newer and runs on Linux, macOS and Windows. Install it from PyPI with pip:
The simulator libroadrunner comes as a binary wheel for all three platforms, so you need no compiler. The one exception is python 3.15: h5py, which writes the result files, has no wheels for it yet, so pip builds it from source. That needs a C compiler and the HDF5 library (libhdf5-dev on Debian and Ubuntu, brew install hdf5 on macOS).
With uv¶
With uv, add sbmlsim to your project, which locks it together with the rest of your environment:
or install it into a virtual environment:
Check the installation¶
Import the package and run a short simulation of one of the models that ship with it:
import sbmlsim
from sbmlsim.resources import REPRESSILATOR_SBML
from sbmlsim.simulation import Simulation
from sbmlsim.simulator import Simulator
print(sbmlsim.__version__)
res = Simulator().run(REPRESSILATOR_SBML, Simulation(end=100))
print(res)
Now continue with the Tutorial.
Optional packages¶
Five features need packages which are not installed with sbmlsim:
| feature | install |
|---|---|
interactive HTML figures of experiments (figure_formats=["html"], see Plots and reports) |
pip install plotly |
| hybrid models with neural networks (PEtab SciML) | pip install "sbmlsim[sciml]" |
COPASI as a second simulation engine (Simulator(engine="copasi"), see COPASI) |
pip install "sbmlsim[copasi]" |
AMICI as a third simulation engine (Simulator(engine="amici"), see AMICI) |
pip install "sbmlsim[amici]" |
| the analyses as task types of simrun, which runs them on a cluster (see simrun) | pip install "sbmlsim[simrun]" |
AMICI has no wheels and is built from source when it is installed. It needs a C++ compiler, a BLAS library with its cblas header and the headers of HDF5 from the system, e.g. on Debian or Ubuntu:
CMake and SWIG come from PyPI with the build of AMICI, and the extra installs ninja, with which AMICI compiles a model.
Development version¶
Install the current state of the develop branch from GitHub:
or with uv:
To work on sbmlsim itself, with the tests and the documentation, see Development.
Dependencies¶
pip installs these packages together with sbmlsim:
| package | used for |
|---|---|
| libroadrunner | simulating the SBML models |
| sbmlutils, python-libsbml | reading, validating and changing SBML models |
| pymetadata | COMBINE archives of PEtab problems |
| numpy, pandas, xarray, scipy, sympy | numerics, data and results |
| h5netcdf, h5py, hdf5plugin | the netCDF files of the results, compressed with zstd |
| sbmlmath | the math of SBML as sympy expressions |
| pint, pydantic | units and validated data |
| petab, pyyaml, SALib | PEtab problems and global sensitivity analysis |
| pkpdutils | non-compartmental pharmacokinetic analysis |
| matplotlib, seaborn, jinja2, rich | figures, reports and console output |
| certifi | the certificates with which sbmlutils and pymetadata reach the network |
Logging¶
sbmlsim logs its messages with the logging module of the standard library, under the logger sbmlsim, and never configures logging itself. Your application decides what is shown:
import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger("sbmlsim").setLevel(logging.WARNING)
In scripts and interactive sessions you can switch on the colored output of rich: