Skip to content

Installation

sbi requires Python 3.9 or higher. A GPU is not required, but can lead to speed-up in some cases. We recommend using a conda virtual environment (Miniconda installation instructions). If conda is installed on the system, an environment for installing sbi can be created as follows:

# Create an environment for sbi (indicate Python 3.8 or higher); activate it
$ conda create -n sbi_env python=3.12 && conda activate sbi_env

Independent of whether you are using conda or not, sbi can be installed using pip:

python -m pip install sbi

To install and add sbi to a project with pixi, from the project directory run

pixi add sbi

and to install into a particular conda environment with conda, in the activated environment run

conda install --channel conda-forge sbi

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

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