Installation#

s2conv is a pure-Python package that requires Python 3.11 or later, and is tested on Python 3.11, 3.12 and 3.13. Its dependencies, NumPy, JAX and s2fft, are installed automatically (on Python 3.13, s2fft 1.5.0 or later).

Installing from PyPI#

Install the latest release of s2conv from PyPI with pip:

pip install s2conv

Installing from source#

To install the development version, clone the repository and install the package with pip:

git clone https://github.com/astro-informatics/s2conv.git
cd s2conv
pip install .

The version of the package is determined from the git history and tags by setuptools-scm, so install from a clone of the repository rather than from an archive of the source files, which has no git history and is given a placeholder version.

To modify the code, install the package in editable mode instead:

pip install -e .

You can check the installation by importing the package:

python -c "import s2conv"

Optional dependencies#

Further dependencies are available as extras, which can be combined:

Extra

Installs

Needed for

tests

pytest and pytest-cov

running the test suite

docs

Sphinx, pydata-sphinx-theme and sphinx-copybutton

building this documentation

notebooks

marimo and matplotlib

running the notebooks in the notebooks directory

ssht

pyssht and ducc0

the "jax_ssht" backend of the transforms

For example, to install the package with the test dependencies and the dependencies of the "jax_ssht" backend:

pip install ".[tests,ssht]"

GPUs and precision#

s2conv runs on whichever devices JAX finds. To use a GPU, install a GPU-enabled build of JAX by following the JAX installation instructions.

s2fft warns that single precision has a dramatic effect on the accuracy of the transforms, even at moderate band-limits. We therefore recommend enabling double precision in JAX before importing s2fft or s2conv:

import jax

jax.config.update("jax_enable_x64", True)

import s2conv