How fix Cartopy pip install error 'Proj 4.9.0 must be installed.'
Problem:
When trying to install cartopy using e.g. pip3 install cartopy
you see this error message:
Collecting cartopy
Downloading Cartopy-0.19.0.post1.tar.gz (12.1 MB)
|████████████████████████████████| 12.1 MB 13.2 MB/s
Installing build dependencies ... done
Getting requirements to build wheel ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 /tmp/tmp2q7tvpo8 get_requires_for_build_wheel /tmp/tmpfwd5htse
cwd: /tmp/pip-install-dg2i313t/cartopy
Complete output (1 lines):
Proj 4.9.0 must be installed.
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 /tmp/tmp2q7tvpo8 get_requires_for_build_wheel /tmp/tmpfwd5htse Check the logs for full command output.
Solution
Install proj
using e.g.
sudo apt -y install libproj-dev
and then install cartopy again using e.g.
sudo pip3 install cartopy