--- id: nutpie version: "0.16.11" license: MIT license_treatment: permissive maintenance: active --- # nutpie — Sample Stan or PyMC models License: permissive · Maintenance: active · Downloads: 305.0K/mo ## 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 above — 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 pip install nutpie uv add nutpie poetry add nutpie ## Installing 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_current - Install friction: medium - Maintenance: active - Downloads: 305.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags bayesian sampling nuts, posterior sampling mcmc, stan inference sampler, nuts algorithm implementation, bayesian model sampling, hierarchical model inference, gradient-based sampling, bayesian-inference, mcmc-sampling, rust-accelerated [View on SkillFed](https://skillfed.io/packages/nutpie) · [View on PyPI](https://pypi.org/project/nutpie/)