Installing Cartopy on Ubuntu
The Python package Cartopy has some external dependencies, meaning installation is more complicated than just pip install cartopy
. The official documentation is a great starting point for Ubuntu, but you may need to follow additional steps for the external dependencies.
Cartopy requires GEOS and PROJ, which on Ubuntu are provided by the packages libgeos-dev
and proj-bin
respectively.
Specifically, Cartopy requires PROJ v8.0.0 or greater. The version of PROJ provided by apt-get install
depends upon the version of Ubuntu. On Ubuntu 22.04, PROJ v8.2.1 is available, so we can just apt-get install
. However, on Ubuntu 20.04, the older release PROJ v6.3.1 is available. To ensure we have PROJ v8.0.0 or greater, we will build PROJ from source1.
These notes cover installing Cartopy v0.20.3 on both Ubuntu 20.04 and Ubuntu 22.04, with PROJ v9.0.0.
Installing Cartopy on Ubuntu 20.04 §
- Install GEOS:
- Install build dependencies for PROJ:
- Download and extract PROJ2:
- Install Cartopy.
Done.
Installing Cartopy on Ubuntu 22.04 §
- Install GEOS and PROJ:
- Install Cartopy.
Done - that’s it!
Troubleshooting §
Unable to determine GEOS version §
Make sure to install GEOS, e.g. sudo apt-get install libgeos-dev
.
Could NOT find TIFF §
Make sure to install a TIFF library, e.g. sudo apt-get install libtiff-dev
.
Proj 8.0.0 must be installed §
Thanks to Recessive for pointing this out. ↩︎
At time of writing, Cartopy requires PROJ v8.0.0 or later. We are installing PROJ v9.0.0. See here for all available releases of PROJ. ↩︎