Skip to content

Commit

Permalink
docs: Add conda-forge install instructions (sbi-dev#1340)
Browse files Browse the repository at this point in the history
* Add install instructions from conda-forge for pixi and conda to README.
   - c.f. https://github.com/conda-forge/sbi-feedstock
* Add conda-forge badge.
* Add install instructions from conda-forge for pixi and conda to docs.
   - Correct minimum required Python to Python 3.9.
   - Update example python version in conda env creation to Python 3.12.
  • Loading branch information
matthewfeickert authored Dec 21, 2024
1 parent d3f22b5 commit 2ecfe21
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 17 deletions.
37 changes: 26 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![PyPI version](https://badge.fury.io/py/sbi.svg)](https://badge.fury.io/py/sbi)
[![Conda Version](https://img.shields.io/conda/vn/conda-forge/sbi.svg)](https://github.com/conda-forge/sbi-feedstock)
[![Contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/sbi-dev/sbi/blob/master/CONTRIBUTING.md)
[![Tests](https://github.com/sbi-dev/sbi/actions/workflows/ci.yml/badge.svg)](https://github.com/sbi-dev/sbi/actions)
[![codecov](https://codecov.io/gh/sbi-dev/sbi/branch/main/graph/badge.svg)](https://codecov.io/gh/sbi-dev/sbi)
Expand Down Expand Up @@ -62,22 +63,36 @@ posterior = inference.build_posterior()
performance in some cases. We recommend using a virtual environment with
[`conda`](https://docs.conda.io/en/latest/miniconda.html) for an easy setup.

To install `sbi`, follow these steps:
If `conda` is installed on the system, an environment for installing `sbi` can be created as follows:

1. **Create a Conda Environment** (if using Conda):
```
conda create -n sbi_env python=3.9 && conda activate sbi_env
```

### From PyPI

To install `sbi` from PyPI run

```
python -m pip install sbi
```

```bash
conda create -n sbi_env python=3.9 && conda activate sbi_env
```
### From conda-forge

2. **Install `sbi`**: Independent of whether you are using `conda` or not, `sbi` can be
installed using `pip`:
To install and add `sbi` to a project with [`pixi`](https://pixi.sh/), from the project directory run

```
pixi add sbi
```

and to install into a particular conda environment with [`conda`](https://docs.conda.io/projects/conda/), in the activated environment run

```
conda install --channel conda-forge sbi
```

```commandline
pip install sbi
```
### Test the installation

3. **Test the installation**:
Open a Python prompt and run

```python
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ samples = posterior.sample((1000,), x=x_o)
**To get started, install the `sbi` package with:**

```commandline
pip install sbi
python -m pip install sbi
```

for more advanced install options, see our [Install Guide](install.md).
Expand Down
22 changes: 17 additions & 5 deletions docs/docs/install.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
# Installation

`sbi` requires Python 3.8 or higher. A GPU is not required, but can lead to
`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`](https://docs.conda.io/en/latest/miniconda.html) virtual environment
([Miniconda installation
instructions](https://docs.conda.io/en/latest/miniconda.html)). If `conda` is
installed on the system, an environment for installing `sbi` can be created as
follows:

```commandline
```console
# Create an environment for sbi (indicate Python 3.8 or higher); activate it
$ conda create -n sbi_env python=3.10 && conda activate sbi_env
$ 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`:

```commandline
pip install sbi
```
python -m pip install sbi
```

To install and add `sbi` to a project with [`pixi`](https://pixi.sh/), from the project directory run

```
pixi add sbi
```

and to install into a particular conda environment with [`conda`](https://docs.conda.io/projects/conda/), in the activated environment run

```
conda install --channel conda-forge sbi
```

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

0 comments on commit 2ecfe21

Please sign in to comment.