From 5f5ba6b61a1a228d47629a7d0e48c13aa0763a62 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Fri, 20 Dec 2024 14:25:09 -0700 Subject: [PATCH] docs: Add conda-forge install instructions * 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. --- README.md | 37 ++++++++++++++++++++++++++----------- docs/docs/index.md | 2 +- docs/docs/install.md | 22 +++++++++++++++++----- 3 files changed, 44 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index fba22574d..d25c78970 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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 diff --git a/docs/docs/index.md b/docs/docs/index.md index bda911023..3dc1a93c7 100644 --- a/docs/docs/index.md +++ b/docs/docs/index.md @@ -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). diff --git a/docs/docs/install.md b/docs/docs/install.md index ecc9a50b3..62c058e6a 100644 --- a/docs/docs/install.md +++ b/docs/docs/install.md @@ -1,6 +1,6 @@ # 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 @@ -8,16 +8,28 @@ 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