Installation
Installing from prepackaged binaries
Stable releases of contourpy are available from both PyPI and conda-forge for Linux,
macOS and Windows.
To install from PyPI:
$ pip install contourpy
To install from conda-forge:
$ conda install -c conda-forge contourpy
The only compulsory runtime dependency is NumPy.
If you want to make use of one of contourpy’s utility renderers in the contourpy.util module
you will also have to install either Matplotlib or Bokeh.
Installing from source
The source code for contourpy is available from github.
Either git clone it directly, or fork and git clone it from your fork, as usual.
Note
You should install contourpy from source into a new virtual environment using conda or
venv for example.
To use venv to create a new virtual environment in a directory called .venv/contourpy
and activate it:
$ python -m venv ~/.venv/contourpy
$ . ~/.venv/contourpy/bin/activate
From the base directory of your local contourpy git repo, build and install it in editable mode
using:
$ pip install -ve .
To build in debug mode, which enables assert statements in the C++ code, use the
CONTOURPY_DEBUG environment variable:
$ CONTOURPY_DEBUG=1 pip install -ve .
To run the test suite, first ensure that the required dependencies are installed and then run the
tests using pytest:
$ pip install -ve .[test]
$ pytest
To build the documentation:
$ pip install -ve .[docs]
$ cd docs
$ make html
Warning
If you modify some of the C++ source code and wish to ensure a completely clean build, you can first use:
$ git clean -fxd
although use this with care as it will also delete any new files that you have created that have
not been added to git and are not mentioned in the .gitignore file.