PyMatching
A package for decoding quantum error correcting codes using minimum-weight perfect matching.
Decision gist · record as of 2026-08-14
Yes. PyMatching is actively maintained, has no known vulnerabilities, uses a permissive Apache 2 license, and is the standard decoder for surface codes in quantum error correction research. Install friction is moderate but manageable with prebuilt wheels. Choose it if you are working with quantum error correction; skip it if you have no quantum computing workflow.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Medium install friction due to compiled wheels for multiple Python versions and platforms (cp310–cp314 across macOS, Linux, Windows).
- Active maintenance with recent release (84 days old) and steady repository activity.
- Four runtime dependencies (scipy, numpy, networkx, matplotlib) are standard scientific stack packages.
License · maintenance · safety
Apache 2 (permissive) — Apache 2 permissive license allows use in commercial and proprietary projects with minimal restrictions; you must include a copy of the license and note any modifications.
last release 2026-05-22 (84 days) · last repo commit 2026-05-22 · 356 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 184,387 downloads/mo, #10,039 on PyPI
Alternatives
Verify before relying
pip install pymatching
import pymatching
import numpy
import networkx
matching = pymatching.Matching()
matching.add_edge(0, 1, weight=1.0)
matching.add_boundary_edge(0, weight=0.5)
syndrome = numpy.array([1, 0, 1])
prediction = matching.decode(syndrome)- Whether the 100–1000x speedup claim in v2 applies to all use cases or primarily surface codes.
- Exact performance characteristics on different hardware architectures beyond M1 processor benchmarks.
- Whether correlated matching (v2.3+) is enabled by default or requires explicit configuration.
- Integration workflow and API details for use with external quantum simulation frameworks.
What it is and what it does
PyMatching decodes quantum error correcting codes by solving the minimum-weight perfect matching problem on detector graphs derived from syndrome measurements. It is built on a sparse blossom algorithm that directly finds minimum-weight paths between detection events, avoiding the computational cost of all-to-all shortest-path searches. The library works with arbitrary weighted graphs (with or without boundaries) and can load matching graphs from check matrices, networkx graphs, or by adding edges individually using scipy, numpy, networkx, and matplotlib for numerical and graph operations.
The package is designed to decode surface codes and other code families (subsystem codes, honeycomb codes, 2D hyperbolic codes) in quantum error correction simulations. It can be configured with custom weighted graphs and integrates with external libraries for circuit-level noise simulation. As of v2.3, it also supports correlated matching to handle errors more accurately. Version 2 includes a substantially faster blossom implementation than earlier releases.
Use it for
- Decode surface code circuits in quantum error correction simulations by configuring matching graphs from syndrome data.
- Estimate the threshold of an error correcting code by running multiple decoding trials with varying noise levels.
- Decode subsystem codes, honeycomb codes, or 2D hyperbolic codes by configuring custom weighted graphs.
- Perform correlated matching on circuits where error correlations are present between graphlike errors.
- Build custom quantum error correction workflows by adding edges individually to a matching graph.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
PyMatching is actively maintained, has no known vulnerabilities, uses a permissive Apache 2 license, and is the standard decoder for surface codes in quantum error correction research. Install friction is moderate but manageable with prebuilt wheels. Choose it if you are working with quantum error correction; skip it if you have no quantum computing workflow.
Install
pymatching on PyPI
Before you install
Medium install friction due to compiled wheels for multiple Python versions and platforms (cp310–cp314 across macOS, Linux, Windows). Active maintenance with recent release (84 days old) and steady repository activity. Four runtime dependencies (scipy, numpy, networkx, matplotlib) are standard scientific stack packages.
License in practice
Apache 2 permissive license allows use in commercial and proprietary projects with minimal restrictions; you must include a copy of the license and note any modifications.
Quickstart
pip install pymatching
import pymatching
import numpy
import networkx
matching = pymatching.Matching()
matching.add_edge(0, 1, weight=1.0)
matching.add_boundary_edge(0, weight=0.5)
syndrome = numpy.array([1, 0, 1])
prediction = matching.decode(syndrome)
Verify before relying
- Whether the 100–1000x speedup claim in v2 applies to all use cases or primarily surface codes.
- Exact performance characteristics on different hardware architectures beyond M1 processor benchmarks.
- Whether correlated matching (v2.3+) is enabled by default or requires explicit configuration.
- Integration workflow and API details for use with external quantum simulation frameworks.
Package facts
| License | Apache 2 permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | 4 packagesscipynumpynetworkxmatplotlib |
| Maintenance | Actively maintained 84 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 184,387 / month, #10,039 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: pymatching-2.4.0-cp310-cp310-macosx_11_0_arm64.whl; pymatching-2.4.0-cp310-cp310-macosx_11_0_x86_64.whl; pymatching-2.4.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; pymatching-2.4.0-cp310-cp310-win_amd64.whl; pymatching-2.4.0-cp311-cp311-macosx_11_0_arm64.whl; pymatching-2.4.0-cp311-cp311-macosx_11_0_x86_64.whl; pymatching-2.4.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; pymatching-2.4.0-cp311-cp311-win_amd64.whl; pymatching-2.4.0-cp312-cp312-macosx_11_0_arm64.whl; pymatching-2.4.0-cp312-cp312-macosx_11_0_x86_64.whl; pymatching-2.4.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; pymatching-2.4.0-cp312-cp312-win_amd64.whl; pymatching-2.4.0-cp313-cp313-macosx_11_0_arm64.whl; pymatching-2.4.0-cp313-cp313-macosx_11_0_x86_64.whl; pymatching-2.4.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; pymatching-2.4.0-cp313-cp313-win_amd64.whl; pymatching-2.4.0-cp314-cp314-macosx_11_0_arm64.whl; pymatching-2.4.0-cp314-cp314-macosx_11_0_x86_64.whl; pymatching-2.4.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; pymatching-2.4.0-cp314-cp314-win_amd64.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 › “quantum error correction decoder”
- PyMatchingPyMatching is a fast Python/C++ library for decoding quantum error…
- ldpcProvides decoders for low-density parity check (LDPC) codes,…
- sinterSinter performs fast Monte Carlo sampling of quantum error correction…
Give your agent the search over MCP, or paste the wish link into any chat.
More Scientific/Engineering packages
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
pandas provides fast, flexible data structures (Series and DataFrame) for loading, cleaning, transforming, and analyzing labeled or relational data in Python.
scipy provides numerical algorithms for mathematics, science, and engineering—including optimization, integration, linear algebra, Fourier transforms, signal and image processing, and ODE solvers—built on numpy arrays.
scikit-learn provides a comprehensive Python library for supervised and unsupervised machine learning, including classification, regression, clustering, dimensionality reduction, and model evaluation tools built on NumPy and SciPy.
Install it if you need to train, evaluate, or deploy supervised or unsupervised learning models.
dill extends Python's pickle module to serialize and deserialize a much wider range of Python objects, including functions, lambdas, classes, and interpreter sessions, to byte streams for storage or network transmission.
Multiprocess is an enhanced fork of Python's standard multiprocessing library that uses dill for better serialization, allowing you to spawn processes with a threading-like API and share complex objects between them.
Install it if you use multiprocessing and encounter pickle serialization limits with lambdas or complex objects.
See also ldpc · pytket · sinter · samplomatic · qiskit-ibm-runtime · mqt.qcec · correctionlib · empirical-calibration · stim · cirq