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 contourpyVerified import paths — ran on the pinned version, not inferred.
A simple example demonstrating how to use ContourPy to generate and visualize contour lines and filled contours from a 2x2 grid of z values.
Upgrade to Python 3.11 or later.
Use with caution or opt for the serial version for stability.
Install the 'matplotlib' package using `pip install matplotlib` or ensure it is included in the project's dependency management.
Install the matplotlib package using 'pip install matplotlib'.
Ensure `contourpy` is installed using `pip install contourpy` or `conda install -c conda-forge contourpy`.
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.
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.
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.