How to fix pip cartopy error: "geos_c.h: No such file or directory"

Problem:

When trying to install cartopy on Linux using e.g. pip install -U cartopy, you see an error message like

cartopy_trace.txt
lib/cartopy/trace.cpp:633:10: fatal error: geos_c.h: Datei oder Verzeichnis nicht gefunden
    633 | #include "geos_c.h"
        |          ^~~~~~~~~~
compilation terminated.
setup.py:117: UserWarning: Unable to determine GEOS version. Ensure you have 3.3.3 or later installed, or installation may fail.

Solution

Install libgeos-dev using

install_libgeos_dev.sh
sudo apt -y install libgeos-dev

Check out similar posts by category: Cartopy, Python