Installation#

sbi requires Python 3.10 or higher. We recommend using Python 3.12 for the best experience. A GPU is not required, but can lead to speed-up in some cases.

Alternative installation methods#

Using pip#

If you prefer using pip directly:

python -m pip install sbi

For Pyro or PyMC MCMC samplers, install the corresponding extras:

python -m pip install "sbi[pyro]"   # or "sbi[pymc]", or "sbi[all]"

Using conda#

To install into a conda environment:

# Create an environment for sbi (Python 3.10 or higher)
conda create -n sbi_env python=3.12 && conda activate sbi_env

# Install sbi from conda-forge
conda install --channel conda-forge sbi

For Pyro or PyMC MCMC samplers, install them as additional conda packages:

conda install --channel conda-forge pyro-ppl  # for Pyro samplers
conda install --channel conda-forge pymc       # for PyMC samplers

Using pixi#

To install and add sbi to a project with pixi:

pixi add sbi

For Pyro or PyMC samplers, add them separately: pixi add pyro-ppl or pixi add pymc.

Testing the installation#

To test the installation, drop into a Python prompt and run:

from sbi.examples.minimal import simple
posterior = simple()
print(posterior)