skillfed

pymc3

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

pymc3 v3.11.6 319.1K downloads/30d#7,647 on PyPI9,710
Permissive license Apache License, Version 2.0 Active released

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 pymc3

uv

uv add pymc3

poetry

poetry add pymc3

Installing 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

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

Tags

bayesian statistical modelingmarkov chain monte carlo samplingprobabilistic programming pythonvariational inference algorithmsbayesian machine learningmcmc posterior inferenceprobabilistic model fitting
bayesian-inferenceprobabilistic-programmingmcmc-sampling

More Scientific/Engineering packages