Skip to content

Installation

smolpack can be installed from PyPI, GitHub, or built from source.


Prerequisites

  • Python 3.10+
  • NumPy (installed automatically as a dependency)

For source builds you additionally need:

  • A C compiler (gcc or clang)
  • meson and meson-python build system
  • numpy (for f2py compilation)

PyPI

For using the PyPI package in your project, add the following to your configuration file:

[project]
dependencies = [
    "smolpack"
]
smolpack

pip

pip install --upgrade smolpack

uv

# Add to a uv project
uv add smolpack

# Or install into the current environment
uv pip install smolpack

pipenv

pipenv install smolpack

poetry

poetry add smolpack

pdm

pdm add smolpack

hatch

hatch add smolpack

git

Install the latest development version directly from the repository:

pip install --upgrade "git+https://github.com/eggzec/smolpack.git#egg=smolpack"

Building locally

Clone and build from source to modify the C code or test local changes:

git clone https://github.com/eggzec/smolpack.git
cd smolpack
uv pip install .

This invokes the meson build system to compile the C sources via f2py and install the resulting extension module.

C compiler required

Source builds require a working C compiler. On most Linux distributions, install gcc:

sudo apt install gcc
sudo dnf install gcc
brew install gcc

Install MinGW-w64 with gcc or use MSYS2.

Verifying the installation

After installation, verify that the package loads correctly:

import numpy as np
import smolpack

result = smolpack.int_smolyak(lambda d, x: np.exp(np.sum(x)), dim=3, qq=5)
print("smolpack is working! Integral:", result)

Dependencies