nutpie
Sample Stan or PyMC models
What it is and what it does
nutpie is a Bayesian sampling library that wraps nuts-rs, a Rust implementation of the No-U-Turn Sampler algorithm. It compiles probabilistic models and samples from their posterior distributions, returning results as ArviZ InferenceData objects compatible with standard Bayesian workflows. The package targets users who want faster sampling, particularly for hierarchical and complex models where gradient evaluation is a bottleneck.
The library integrates with existing model ecosystems, accepting model definitions in native syntax and producing compatible output. It supports both blocking and non-blocking sampling modes, allowing interactive control (pause, resume, abort) over long-running inference tasks. Dependencies include data handling (pandas, pyarrow, xarray), statistical output (arviz), and storage (zarr, obstore), reflecting its role as a sampler within existing Bayesian analysis pipelines.
Use it for:
- Accelerate sampling for hierarchical models by replacing default samplers without rewriting model code.
- Sample large models where gradient evaluation dominates runtime, using Rust backend for speed.
- Interactively monitor and control long-running Bayesian inference via pause/resume without blocking.
- Combine with arviz for post-sampling diagnostics and visualization of posterior traces.
- Prototype models, then accelerate sampling without changing model definitions.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
nutpie provides a fast NUTS sampler for Bayesian inference on PyMC and Stan models, using a Rust-based implementation.
Yes, if you use Bayesian modeling and want faster sampling with minimal code changes. The package is actively maintained with recent releases, has no known vulnerabilities, and offers pre-built wheels for modern Python versions. Install friction is moderate due to Rust compilation on source builds, but pre-built wheels mitigate this for standard platforms. The MIT license poses no restrictions. Verify that sampling efficiency gains apply to your specific models before adopting as a primary sampler.
Install
nutpie on PyPI
pip
pip install nutpieuv
uv add nutpiepoetry
poetry add nutpieInstalling nutpie
Before you install
Medium install friction due to Rust compilation requirement. Pre-built wheels available for Python 3.12–3.14 across macOS, Linux, and Windows reduce friction for standard platforms. Eight runtime dependencies add some complexity but are widely used data and statistical libraries.
License in practice
MIT license is permissive and imposes no significant restrictions on use, modification, or redistribution in commercial or private projects.
Quickstart
pip install nutpie
import nutpie
# After defining a model:
compiled_model = nutpie.compile_pymc_model(pymc_model)
trace = nutpie.sample(compiled_model)
Requires Python ≥3.12. For source builds, a Rust compiler and maturin are needed. Stan support requires bridgestan and a C++ compiler.
Verify before relying
- Whether the claimed higher effective sample size per gradient evaluation is validated in peer-reviewed benchmarks.
- Performance characteristics and convergence speed relative to standard samplers in real-world hierarchical models.
- Whether the SIMD support feature provides measurable speedup and which models benefit most.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.12) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 8 — pyarrow, arro3-core, pandas, platformdirs, xarray, arviz, obstore, zarr |
| Maintenance | actively maintained — 45 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 305,005/month — #7,800 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: nutpie-0.16.11-cp312-cp312-macosx_10_12_x86_64.whl; nutpie-0.16.11-cp312-cp312-macosx_11_0_arm64.whl; nutpie-0.16.11-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; nutpie-0.16.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; nutpie-0.16.11-cp312-cp312-win_amd64.whl; nutpie-0.16.11-cp313-cp313-macosx_10_12_x86_64.whl; nutpie-0.16.11-cp313-cp313-macosx_11_0_arm64.whl; nutpie-0.16.11-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; nutpie-0.16.11-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; nutpie-0.16.11-cp313-cp313-win_amd64.whl; nutpie-0.16.11-cp314-cp314-macosx_10_12_x86_64.whl; nutpie-0.16.11-cp314-cp314-macosx_11_0_arm64.whl; nutpie-0.16.11-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; nutpie-0.16.11-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; nutpie-0.16.11-cp314-cp314-win_amd64.whl
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
pymcPyMC is a Python package for Bayesian…
permissive · top 5,000 on PyPI
pystanPyStan provides a Python interface to Stan for…
permissive · top 5,000 on PyPI
httpstanhttpstan provides an HTTP REST interface to the…
permissive · top 5,000 on PyPI
pymc-extrasExtends PyMC with specialized distributions,…
permissive · top 15,000 on PyPI
cmdstanpyCmdStanPy provides a pure-Python interface to…
permissive · top 5,000 on PyPI
emceeemcee implements affine-invariant ensemble…
permissive · top 5,000 on PyPI
pymc3PyMC3 is a Python package for Bayesian…
permissive · top 15,000 on PyPI
numpyroNumPyro is a probabilistic programming library…
permissive · top 15,000 on PyPI
pymc-marketingPyMC-Marketing provides Bayesian statistical…
permissive · top 15,000 on PyPI
arviz-baseProvides converters and base data manipulation…
permissive · top 15,000 on PyPI