pymc3
Probabilistic Programming in Python: Bayesian Modeling and Probabilistic Machine Learning with Theano
What it is and what it does
PyMC3 is a mature probabilistic programming framework that lets you specify Bayesian statistical models using intuitive syntax and then fit them using state-of-the-art sampling and inference algorithms. It wraps theano-pymc for computational optimization and provides both MCMC methods (including the No U-Turn Sampler) and variational inference (ADVI) for approximate posterior estimation, making it applicable to a wide range of statistical modeling problems.
The package is designed for researchers and practitioners who need flexible Bayesian modeling without deep expertise in sampling algorithms. It handles missing value imputation transparently and supports complex models. However, PyMC3 is now considered legacy—the project has been renamed to PyMC and moved to newer computational backends. New projects should evaluate whether to use the current PyMC version instead, though PyMC3 remains functional and documented.
Use it for:
- Fit hierarchical Bayesian models to experimental or observational data with uncertainty quantification
- Perform approximate Bayesian inference on large datasets using mini-batch ADVI
- Build custom probabilistic models for time-series forecasting, causal inference, or mixed-effects analysis
- Impute missing values in datasets while propagating uncertainty through downstream analyses
- Compare competing statistical models using posterior predictive checks and model diagnostics
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
PyMC3 is a Python package for Bayesian statistical modeling and probabilistic machine learning, implementing advanced Markov chain Monte Carlo (MCMC) and variational inference algorithms for complex probabilistic models.
Yes, but with conditions. PyMC3 is production-stable and well-documented, with low install friction and no known vulnerabilities. However, it is now legacy—the PyMC project has been renamed and moved to newer backends. Install PyMC3 if you are maintaining existing code, learning Bayesian modeling from established tutorials, or need its specific theano-pymc integration. For new projects, evaluate the current PyMC version first to avoid future maintenance burden.
Install
pymc3 on PyPI
pip
pip install pymc3uv
uv add pymc3poetry
poetry add pymc3Installing pymc3
Before you install
Low install friction with a pure-wheel distribution and 12 runtime dependencies. The package is actively maintained with recent commits and has been in production use since 2016, though it is now legacy—the project has transitioned to PyMC (renamed), and this version relies on theano-pymc as its computational backend.
License in practice
Licensed under Apache License, Version 2.0 (permissive), allowing commercial and private use with minimal restrictions. You may use, modify, and distribute PyMC3 freely provided you include the license notice.
Quickstart
import pymc3 as pm
import numpy as np
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]))
trace = pm.sample()
Requires theano-pymc as a compiled backend; some systems may need additional build tools or BLAS/LAPACK libraries for optimal performance.
Verify before relying
- Whether theano-pymc remains actively maintained and suitable for new projects given PyMC3's legacy status
- Performance characteristics and scalability for models with many parameters
- Compatibility and migration path from PyMC3 to the current PyMC version
Package facts
| License | Apache License, Version 2.0 (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 12 — arviz, cachetools, deprecat, dill, fastprogress, numpy, pandas, patsy, scipy, semver, theano-pymc, typing-extensions |
| Maintenance | actively maintained — 805 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 319,118/month — #7,647 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pymc3-3.11.6-py3-none-any.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
emceeemcee implements affine-invariant ensemble…
permissive · top 5,000 on PyPI
pymcPyMC is a Python package for Bayesian…
permissive · top 5,000 on PyPI
pymc-extrasExtends PyMC with specialized distributions,…
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
cmdstanpyCmdStanPy provides a pure-Python interface to…
permissive · top 5,000 on PyPI
google-meridianMeridian is a Bayesian marketing mix modeling…
unclear · top 15,000 on PyPI
nutpienutpie provides a fast NUTS sampler for…
permissive · top 15,000 on PyPI
pyAgrum-nightlypyAgrum is a Python library for creating,…
unclear · top 15,000 on PyPI
tensorflow-probabilityTensorFlow Probability provides probabilistic…
permissive · top 5,000 on PyPI