Install & Compatibility
Where this runs
tested against v5.25.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
py 3.12
✕ build_error
1/2 runs
py 3.13
✕ build_error
1/2 runs
699MB installed
● package 699MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Model
✓ import pymc as pm
✗ import pymc as pm
Model
✓ from pymc import Model
✗ import pymc as pm
This quickstart demonstrates how to define a simple Bayesian linear regression model, assign priors, specify the likelihood, and sample from the posterior distribution using PyMC.
import pymc as pm
import numpy as np
# 1. Generate some dummy data
true_slope = 2
true_intercept = 5
noise_std = 1
np.random.seed(42)
x_data = np.random.normal(0, 1, 100)
y_data = true_intercept + true_slope * x_data + np.random.normal(0, noise_std, 100)
# 2. Define the PyMC model
with pm.Model() as linear_model:
# Priors for the model parameters
intercept = pm.Normal("intercept", mu=0, sigma=10)
slope = pm.Normal("slope", mu=0, sigma=10)
# Expected value of y
mu = intercept + slope * x_data
# Likelihood (sampling distribution) of observations
y_observed = pm.Normal("y_observed", mu=mu, sigma=1, observed=y_data)
# 3. Sample from the posterior distribution
trace = pm.sample(2000, tune=1000, return_inferencedata=True, cores=1)
# 4. Print trace summary
print(trace)
Debug
Known issues
breakingThe library has been renamed from `pymc3` to `pymc` starting with version 4.0. The `pymc3` package (version 3.x) is effectively end-of-life and no longer maintained. Most recent documentation and examples refer to `pymc` (v4+).fixInstall `pymc` (`pip install pymc`). Update all imports from `pymc3` to `pymc` (e.g., `import pymc as pm`). Review the official migration guide for additional API changes.
affects: All code written for `pymc3` (version 3.x) will break when trying to use `pymc` (version 4.x and newer) without modification.
breakingPyMC v4 and newer use `PyTensor` (a fork of Theano, previously known as `theano-pymc`) as their computational backend, replacing the original `Theano` library used by PyMC3. Direct interaction with `Theano` objects in PyMC v3 code will likely fail.fixEnsure `pytensor` is installed (`pip install pytensor`). When migrating from PyMC3, expect that any direct `Theano` tensor operations or functions will need to be replaced with `PyTensor` equivalents or rely on PyMC's higher-level abstractions.
affects: pymc>=4.0
breakingBeyond the name change, there are significant API changes between PyMC3 and PyMC v4/v5. For example, the `Model` context manager behavior, `sample` function arguments, and how `Deterministic` variables are defined have changed.fixConsult the official PyMC migration guide (e.g., 'From PyMC3 to PyMC v4', 'v4 to v5') for detailed changes. Pay attention to `pm.Deterministic` (now name-first), `pm.Potential`, and `pm.sample` arguments.
affects: pymc>=4.0
gotchaPyMC v5.26.0 and newer have dropped explicit support for NumPy <2.0. Using an older PyMC with NumPy 2.0, or a newer PyMC with older NumPy, might lead to unexpected behavior or errors.fixEnsure `numpy` is installed at a compatible version. For `pymc>=5.26.0`, it's recommended to use `numpy>=2.0`. The `pip install pymc` command generally handles `numpy` compatibility through dependency resolution.
affects: pymc>=5.26.0
Upgrade
Version history
6.3.1latest on PyPI · released Aug 16, 2026
Audit
Dependencies
pytensorrequiredRequired computational backend for PyMC v4+ (replaces Theano).
arvizoptionalFor diagnostic plots, posterior analysis, and result summary.
numpyrequiredFundamental for numerical operations.
scipyrequiredFor various statistical functions.