cma
CMA-ES, Covariance Matrix Adaptation Evolution Strategy for non-linear numerical optimization in Python
What it is and what it does
CMA-ES (Covariance Matrix Adaptation Evolution Strategy) is a randomized, derivative-free optimization algorithm implemented in Python for solving difficult continuous and mixed-integer optimization problems. It is designed for objective functions where gradients are unavailable or unhelpful, the search space has dependent variables, and the landscape may be non-convex, ill-conditioned, multi-modal, or noisy. The package provides two independent implementations via the CMAEvolutionStrategy class and a basic purecma.CMAES variant.
The algorithm is most effective for problems with search space dimensions between five and a few hundred, requiring at least around 100 times the dimension in function evaluations. CMA-ES handles bound constraints, linear and nonlinear constraints, noise, and integer variables for mixed-integer problems. It offers both a direct optimization interface (fmin2) and an ask-and-tell interface for fine-grained control over the iteration loop. The package depends only on numpy for array operations.
Use it for:
- Optimize expensive black-box functions where gradients are unavailable or unreliable
- Solve non-convex or multi-modal optimization problems in 5-100+ dimensions
- Handle constrained optimization with bounds or nonlinear constraints
- Tune hyperparameters or design parameters in machine learning or engineering workflows
- Optimize noisy objective functions where derivative-based methods fail
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
CMA-ES is a derivative-free numerical optimization algorithm for difficult non-convex, multi-modal, or ill-conditioned optimization problems in continuous or mixed-integer search spaces.
Yes. CMA-ES is a well-maintained, production-stable algorithm with no known vulnerabilities, low install friction, and permissive licensing. Install it if you need derivative-free optimization for difficult non-convex problems in moderate dimensions; skip it if you have gradients available or are optimizing in very small dimensions where faster methods exist.
Install
cma on PyPI
pip
pip install cmauv
uv add cmapoetry
poetry add cmaInstalling cma
Before you install
Low friction install with only numpy as a runtime dependency. Active maintenance with recent releases and a stable codebase.
License in practice
BSD-3-Clause is a permissive license allowing commercial and private use with minimal restrictions.
Quickstart
pip install cma
import cma
es = cma.CMAEvolutionStrategy(8 * [0], 0.5)
xopt, es = cma.fmin2(cma.ff.rosen, 8 * [0], 0.5)
Verify before relying
- Whether the package supports Python 3.10+ or has specific version constraints beyond 'Python 3'
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — numpy |
| Maintenance | actively maintained — 170 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,813,205/month — #3,527 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: cma-4.4.4-py3-none-any.whl
Keywords: optimization, CMA-ES, cmaes
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
cmaesProvides CMA-ES (Covariance Matrix Adaptation…
permissive · top 5,000 on PyPI
directsearchSolves unconstrained and linearly constrained…
copyleft · top 15,000 on PyPI
deapDEAP is an evolutionary computation framework…
copyleft · top 15,000 on PyPI
ropwrRoPWR computes optimal piecewise polynomial…
permissive · top 15,000 on PyPI
bayesian-optimizationBayesian optimization using Gaussian processes…
permissive · top 15,000 on PyPI
scikit-optimizeScikit-Optimize is a library for optimizing…
permissive · top 15,000 on PyPI
MosekMOSEK solves large-scale convex and…
unclear · top 15,000 on PyPI
nevergradNevergrad is a gradient-free optimization…
permissive · top 15,000 on PyPI
nvidia-modeloptApplies state-of-the-art model optimization…
permissive · top 15,000 on PyPI
nvidia-cusolver-cu11Provides NVIDIA CUDA solver native runtime…
unclear · top 5,000 on PyPI