Registry / data / contourpy

contourpy

JSON →
library1.3.3pypypi✓ verified 27d ago

ContourPy is a Python library for calculating contours of 2D quadrilateral grids, written in C++11 and wrapped using pybind11. It offers algorithms used in Matplotlib, including the 2005 and 2014 versions, as well as a newer algorithm with additional features available in both serial and multithreaded versions. The current version is 1.3.3, released on March 7, 2026, with a release cadence of approximately every 2-3 months.

pip install contourpy
INSTALL
IMPORT
SIG · CONTOURPY
C
contourpy
datapythonv1.3.3
Install
3.9s avg
Import
246ms
Disk
92MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.3.2 · 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
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.246s · 94.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.9s · import 0.246s · 87MB
92MB installed
● package 92MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

contour_generator
from contourpy import contour_generator
Ensure correct import path to access contour generation functions

A simple example demonstrating how to use ContourPy to generate and visualize contour lines and filled contours from a 2x2 grid of z values.

import numpy as np from contourpy import contour_generator # Create a 2x2 grid of z values z = np.array([[0.0, 0.1], [0.2, 0.3]]) # Initialize the contour generator cont_gen = contour_generator(z=z) # Calculate contour lines at z-level 0.25 lines = cont_gen.lines(0.25) # Calculate filled contours between z-levels 0.15 and 0.25 filled = cont_gen.filled(0.15, 0.25) # Visualize the contours using Matplotlib import matplotlib.pyplot as plt fig, ax = plt.subplots() for line in lines: ax.plot(line[:, 0], line[:, 1], color='red') for polygon in filled[0]: ax.fill(polygon[:, 0], polygon[:, 1], color='gold', alpha=0.5) plt.show()
Debug
Known issues
breakingSupport for Python versions below 3.11 has been dropped in version 1.3.3.
fix
Upgrade to Python 3.11 or later.
affects: 1.3.3
deprecatedThe multithreaded option in the newer algorithm is considered experimental.
fix
Use with caution or opt for the serial version for stability.
affects: 1.3.0
breakingMissing required package: 'matplotlib'. The package 'matplotlib' was not found in the environment, preventing the script from running.
fix
Install the 'matplotlib' package using `pip install matplotlib` or ensure it is included in the project's dependency management.
affects: 1.3.3
breakingThe 'matplotlib' package is not installed, leading to a ModuleNotFoundError.
fix
Install the matplotlib package using 'pip install matplotlib'.
affects: *
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'contourpy'
The `contourpy` package is not installed in the current Python environment or is not accessible via `sys.path`.
fix
Ensure `contourpy` is installed using `pip install contourpy` or `conda install -c conda-forge contourpy`.
ERROR: Could not build wheels for contourpy, which is required to install pyproject.toml-based projects.
`pip` failed to compile the C++ extension of `contourpy` from source, often due to missing build tools (like a C++ compiler, `meson`, or `ninja`) or environment-specific issues.
fix
Install necessary build tools for your operating system (e.g., `build-essential` on Linux, Xcode on macOS, Visual C++ Build Tools on Windows) and then retry `pip install contourpy`. Alternatively, use `conda install -c conda-forge contourpy` to install pre-built binaries.
ERROR: Could not find a version that satisfies the requirement contourpy==X.Y.Z (from versions: ...)
The specified version of `contourpy` is not available for your current Python version or operating system, or there is a conflict with other installed packages requiring a different Python version.
fix
Check the Python version compatibility requirements for the desired `contourpy` version and upgrade your Python environment if needed. Try installing without a specific version constraint (`pip install contourpy`) to allow `pip` to find a compatible binary wheel, or manually select an older `contourpy` version known to be compatible with your Python.
A module that was compiled using NumPy 1.x cannot be run in NumPy 2.0.0.dev0 as it may crash.
The `contourpy` library, or a dependency of it, was compiled against a different major version of NumPy than the one currently installed, leading to potential Application Binary Interface (ABI) incompatibility.
fix
Downgrade NumPy to a version compatible with `contourpy` (typically `<2.0` if `contourpy` hasn't released a 2.x compatible version) or upgrade `contourpy` to a version that officially supports NumPy 2.0. Reinstalling `contourpy` and its dependencies after adjusting NumPy versions is recommended.
Upgrade
Version history
1.3.3latest on PyPI · released Jul 26, 2025
Audit
Dependencies
numpyrequiredRequired for numerical operations
Agent activity
61 hits · last 30 days
node
54
OpenAI (training)
1
Resources
contourpy — pip install contourpy · libregistry