Cartopy (as of v0.22+) provides binary wheels for most major operating systems. The easiest way to install Cartopy is:
pip install cartopy
Additional pre-built binaries can be found at a variety of sources, including:
Building from source#
Before building Cartopy from source, you need to first install the required dependencies listed below. Once these are installed, Cartopy can be installed using the pip installer:
pip install cartopy
To instead install the most recent version found on the GitHub main branch, use:
pip install git+https://github.com/SciTools/cartopy.git
Alternatively, you can clone the git repo on your computer and install manually
git clone https://github.com/SciTools/cartopy.git cd cartopy # Uncomment the following to specify non-standard include and library paths # python setup.py build_ext -I/path/to/include -L/path/to/lib python setup.py install
In order to install Cartopy, or to access its basic functionality, it will be necessary to first install the required dependencies listed below. These packages can be installed using pip.
We include a conda environment file that contains a list of all the dependencies required to build and install cartopy, which can be used to install pre-built binaries of all the dependencies on your local system. To use it:
git clone https://github.com/SciTools/cartopy.git cd cartopy conda env create -f environment.yml conda activate cartopy-dev pip install -e .
Further information about the required dependencies can be found here:
- Python 3.9 or later (https://www.python.org/)
Python 2 support was removed in v0.19.
- Matplotlib 3.4 or later (https://matplotlib.org/)
Python package for 2D plotting. Python package required for any graphical capabilities.
- Shapely 1.7.1 or later (shapely/shapely)
Python package for the manipulation and analysis of planar geometric objects.
- pyshp 2.1 or later (https://pypi.python.org/pypi/pyshp)
Pure Python read/write support for ESRI Shapefile format.
- pyproj 3.1.0 or later (pyproj4/pyproj)
Python interface to PROJ (cartographic projections and coordinate transformations library).
To make the most of Cartopy by enabling additional functionality, you may want
to install these optional dependencies. They are also included in some of the
optional groups when installing. For example, use
pip install .[ows] to install
the optional OWS libraries.
- Pillow 6.1.0 or later (https://python-pillow.org)
A popular fork of PythonImagingLibrary.
- pykdtree 1.2.2 or later (storpipfugl/pykdtree)
A fast kd-tree implementation that is used for faster warping of images than SciPy.
- SciPy 1.6.3 or later (https://www.scipy.org/)
A Python package for scientific computing.
- OWSLib 0.24.1 or later (https://pypi.python.org/pypi/OWSLib)
A Python package for client programming with the Open Geospatial Consortium (OGC) web service, and which gives access to Cartopy ogc clients.
- Fiona 1.0 or later (Toblerity/Fiona)
A Python package for reading shapefiles that is faster than pyshp.
These packages are required for the full Cartopy test suite to run.