skillfed

pymc

Probabilistic Programming in Python: Bayesian Modeling and Probabilistic Machine Learning with PyTensor

pymc v6.3.0 5.5M downloads/30d#2,088 on PyPI9,710
Permissive license Apache License, Version 2.0 Active released

What it is and what it does

PyMC is a framework for specifying and fitting Bayesian statistical models using probabilistic programming. It translates intuitive mathematical notation (like x ~ N(0,1)) into executable inference code, handling the computational complexity of sampling from posterior distributions. The package combines advanced sampling algorithms—including the No U-Turn Sampler—with variational inference methods for both exact and approximate posterior estimation, making it suitable for models ranging from simple regression to complex hierarchical structures.

Under the hood, PyMC relies on PyTensor for computation optimization and can compile models to C or JAX for performance. It integrates with numpy, scipy, and pandas for data handling, and uses arviz for posterior analysis and visualization. The package is designed for researchers and practitioners who need flexible Bayesian inference without deep expertise in sampling algorithm implementation.

Use it for:

  • Fit Bayesian linear or generalized linear regression models to estimate parameter uncertainty and credible intervals.
  • Perform hierarchical modeling for grouped data, such as multi-site experiments or nested study designs.
  • Conduct prior sensitivity analysis and posterior predictive checks to validate model assumptions.
  • Estimate missing values in datasets using transparent imputation within a probabilistic framework.
  • Compare competing Bayesian models using posterior predictive distributions and information criteria.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

PyMC is a Python package for Bayesian statistical modeling and probabilistic programming, providing advanced MCMC and variational inference algorithms for parameter estimation and posterior inference.

Yes. PyMC is production-stable (Development Status 5), actively maintained with a recent release, carries no known vulnerabilities, and uses a permissive Apache 2.0 license. It has low install friction and broad adoption (top 5000 on PyPI). Install it if you need to fit Bayesian models with flexible inference algorithms; avoid it only if you require Python versions below 3.12 or have no need for probabilistic modeling.

Install

pymc on PyPI

pip

pip install pymc

uv

uv add pymc

poetry

poetry add pymc

Installing pymc

Before you install

Low install friction with a pure-Python wheel distribution. Active maintenance with a release 2 days old and 9710 repository stars. Requires Python 3.12 or later and depends on 10 runtime packages including numpy, scipy, pytensor, and arviz.

License in practice

Licensed under Apache License 2.0 (permissive), allowing commercial and private use with minimal restrictions beyond attribution and liability disclaimers.

Quickstart

import pymc as pm
import numpy as np

# Define a simple Bayesian model
with pm.Model() as model:
    mu = pm.Normal('mu', mu=0, sigma=1)
    obs = pm.Normal('obs', mu=mu, sigma=1, observed=np.array([1, 2, 3]))
    idata = pm.sample(random_seed=42)

print(pm.stats.summary(idata))

Requires Python 3.12 or later; computationally intensive models may benefit from a system with multiple CPU cores due to threadpoolctl dependency.

Verify before relying

  • Whether JAX compilation support is available out-of-the-box or requires additional setup beyond the listed dependencies.
  • Performance characteristics and scalability limits for models with thousands of parameters mentioned in the description.

Package facts

License Apache License, Version 2.0 (permissive)
Python support supports the current Python release (>=3.12)
Install friction low — pure-Python wheel
Runtime dependencies 10 — arviz, cachetools, cloudpickle, numpy, pandas, pytensor, rich, scipy, threadpoolctl, typing-extensions
Maintenance actively maintained — 2 days since the last release
Last repo commit
First released
Downloads 5,495,668/month — #2,088 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pymc-6.3.0-py3-none-any.whl

Development Status :: 5 - Production/StableIntended Audience :: Science/ResearchLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Scientific/EngineeringTopic :: Scientific/Engineering :: Mathematics

Tags

bayesian statistical modelingmarkov chain monte carlo samplingvariational inference pythonprobabilistic programmingposterior inference mcmcbayesian regression modelingparameter estimation sampling
bayesian-inferencemcmc-samplingprobabilistic-programming

More Scientific/Engineering packages