Installation¶
sbi requires Python 3.10 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.10 or higher); activate it
$ conda create -n sbi_env python=3.10 && 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
If uv is installed on the system, an environment for installing sbi can be created as follows:
uv venv -p 3.10
Then activate the virtual enviroment by running:
-
For
macOSorLinuxuserssource .venv/bin/activate -
For
Windowsusers.venv\Scripts\activate
To install sbi run
uv add sbi
To test the installation, drop into a Python prompt and run
from sbi.examples.minimal import simple
posterior = simple()
print(posterior)