emcee
The Python ensemble sampling toolkit for MCMC
Decision gist · record as of 2026-08-14
Yes. emcee is a mature, well-maintained library with low install friction, no known vulnerabilities, and a permissive license. It is the standard choice for ensemble MCMC in Python and has proven utility in published research. Install it if you need to perform Bayesian inference or sample from complex posterior distributions.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low install friction with a single runtime dependency (numpy) and a pure-Python wheel distribution.
- The package is actively maintained with a recent release and 1597 repository stars, indicating stable community adoption.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted commercial and private use, modification, and distribution with minimal restrictions—suitable for most research and production contexts.
last release 2024-04-19 (847 days) · last repo commit 2026-08-10 · 1,597 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 846,561 downloads/mo, #4,916 on PyPI
Alternatives
Verify before relying
import numpy as np
import emcee
# Define log-probability function
def log_prob(x):
return -0.5 * np.sum(x**2)
# Initialize sampler with walkers and dimensions
sampler = emcee.EnsembleSampler(n_walkers, n_dims, log_prob)
# Run MCMC
sampler.run_mcmc(initial_state, n_steps)- Whether the package supports GPU acceleration or distributed computing beyond standard multiprocessing.
- Performance characteristics and scalability limits for high-dimensional parameter spaces.
- Compatibility with modern Python versions (requires_python is unspecified in metadata).
- Recommended walker count and step count for typical inference problems.
What it is and what it does
emcee is a production-grade Python implementation of the affine-invariant ensemble sampler for MCMC, a statistical technique for sampling from complex probability distributions. It is commonly used in Bayesian inference, parameter estimation, and model fitting where you need to explore a posterior distribution and extract credible intervals or point estimates. The package wraps the algorithm proposed by Goodman & Weare (2010) and has been used in published astrophysics research.
The core dependency is numpy, and the package is designed to run on standard Python without compiled extensions. It provides an ensemble-based approach where multiple parallel walkers explore the parameter space, making it well-suited for problems where traditional single-chain samplers would be slow or inefficient. The API is straightforward: define a log-probability function, initialize an EnsembleSampler, and call run_mcmc to generate samples.
Use it for
- Fitting model parameters to observational data in astronomy or physics by sampling the posterior distribution.
- Uncertainty quantification in scientific computing where you need credible intervals on fitted parameters.
- Bayesian model comparison by computing marginal likelihoods or evidence from MCMC chains.
- Calibrating complex simulators or forward models by inferring input parameters that match observed outputs.
- Exploratory data analysis in high-dimensional spaces where you need to understand the structure of a probability distribution.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
emcee is a mature, well-maintained library with low install friction, no known vulnerabilities, and a permissive license. It is the standard choice for ensemble MCMC in Python and has proven utility in published research. Install it if you need to perform Bayesian inference or sample from complex posterior distributions.
Install
emcee on PyPI
Before you install
Low install friction with a single runtime dependency (numpy) and a pure-Python wheel distribution. The package is actively maintained with a recent release and 1597 repository stars, indicating stable community adoption.
License in practice
MIT license permits unrestricted commercial and private use, modification, and distribution with minimal restrictions—suitable for most research and production contexts.
Quickstart
import numpy as np
import emcee
# Define log-probability function
def log_prob(x):
return -0.5 * np.sum(x**2)
# Initialize sampler with walkers and dimensions
sampler = emcee.EnsembleSampler(n_walkers, n_dims, log_prob)
# Run MCMC
sampler.run_mcmc(initial_state, n_steps)
Verify before relying
- Whether the package supports GPU acceleration or distributed computing beyond standard multiprocessing.
- Performance characteristics and scalability limits for high-dimensional parameter spaces.
- Compatibility with modern Python versions (requires_python is unspecified in metadata).
- Recommended walker count and step count for typical inference problems.
Package facts
| License | MIT permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagenumpy |
| Maintenance | Actively maintained 847 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 846,561 / month, #4,916 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python |
Evidence: emcee-3.1.6-py2.py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “Bayesian inference ensemble”
- emceeemcee implements affine-invariant ensemble sampling for Markov chain…
- iterative-ensemble-smootherImplements ensemble-based data assimilation and history matching…
- numpyroNumPyro is a probabilistic programming library that uses JAX for…
Give your agent the search over MCP, or paste the wish link into any chat.
More Mathematics packages
NetworkX provides data structures and algorithms for creating, analyzing, and manipulating graphs and networks, supporting everything from simple undirected graphs to complex directed and weighted networks.
kiwisolver is a Python binding to a fast C++ implementation of the Cassowary constraint solver, enabling you to solve systems of linear constraints and inequalities.
Install it if you need to solve constraint systems; skip it if you only need simple linear algebra.
SymPy is a Python library for symbolic mathematics, performing algebraic manipulation, calculus, equation solving, and mathematical expression simplification without numerical approximation.
ContourPy calculates contours of 2D quadrilateral grids using C++11 algorithms wrapped in Python, offering serial and multithreaded implementations without requiring Matplotlib as a dependency.
PyTorch provides GPU-accelerated tensor computation and automatic differentiation for building and training deep neural networks in Python.
onnxruntime loads and executes Open Neural Network Exchange (ONNX) models with a focus on inference performance across CPUs and accelerators.
Install it if you have ONNX models to run in production or development.
See also iterative-ensemble-smoother · pymc3 · tensorflow-probability · pymc · nutpie · pymc-extras · cmdstanpy · httpstan · numpyro · google-meridian