Cartopy / Installation errors

Causes and fixes for Cartopy installation errors

Common errors when installing Cartopy and drawing a first map, listed by exact message, each with its cause and fix.

Short answer

Cartopy depends on the PROJ and GEOS C libraries, and older versions installed with pip compile from source on your machine, so a missing or wrong version of either library makes the install fail.

Setting up your environment this way avoids most errors on this page.

PracticeWhat happens if you skip it
Install with conda install -c conda-forge cartopy in a new environment.pip needs suitable PROJ and GEOS versions already on your machine and fails easily, especially on Windows.
With pip, install Cartopy 0.21 or later.Older versions require a specific local PROJ version and fail with Proj must be installed.
Do not mix libproj and libgeos from apt with those in a conda environment.The wrong library loads at runtime and you get libproj.so not found or version conflicts.
On Windows, install pyproj, shapely and Cartopy from the same source.Binary packages from different sources are incompatible and import fails with DLL load failed.
On restricted networks, download the Natural Earth data to ~/.local/share/cartopy/shapefiles in advance.The automatic download on the first coastline plot fails with a certificate error or hangs.

Troubleshooting by error message

Find your exact error message. Each entry gives the cause, the fix, and what may come up after the fix.

Proj 8.0.0 must be installed. (or Proj version 6.3.1 is installed, but cartopy requires at least version 8.0.0.)

Cause: Cartopy 0.20 compiles from source when installed with pip and requires PROJ 8 or later on your machine.

Fix: Upgrade to Cartopy 0.21 or later, which drops the minimum local PROJ requirement, or use conda install -c conda-forge cartopy.

Proj 4.9.0 must be installed. (pip install of Cartopy 0.19 or earlier on Linux)

Cause: The PROJ development library is missing.

Fix: On Ubuntu run sudo apt install libproj-dev libgeos-dev, then pip install -U cartopy.

What may come next: If the system PROJ is too old, upgrading Cartopy may then raise the Proj 8.0.0 error above, and conda becomes the easier route.

UserWarning: Unable to determine GEOS version. Ensure you have 3.7.2 or later installed, or installation may fail.

Cause: pip cannot find the GEOS library while compiling Cartopy from source.

Fix: Install libgeos-dev on Ubuntu or run brew install proj geos on macOS, then install again; on Windows, use conda.

ImportError: DLL load failed: The specified module could not be found. (on import cartopy, Windows)

Cause: The binary builds of pyproj, shapely, Pillow and other dependencies do not match Cartopy in source or version.

Fix: Create a new conda environment and install Cartopy with all its dependencies via conda install -c conda-forge cartopy.

What may come next: Reinstalling dependencies one by one in the old environment can run into other version conflicts.

ImportError: libproj.so.19: cannot open shared object file: No such file or directory

Cause: The PROJ version in the conda environment differs from the one Cartopy was built with, often after installing into base.

Fix: Create a new environment with pinned versions, for example conda create -n geo -c conda-forge "cartopy>=0.18" "proj>=7" "pyproj>=2.6".

What may come next: If PROJ from apt is also on the system, environment variables may load it first, so check which library is used.

ModuleNotFoundError: No module named 'versioneer' (pip install of Cartopy 0.17)

Cause: The Cartopy 0.17 source package is incompatible with how newer pip versions build packages.

Fix: Install a newer Cartopy; if you must use 0.17, run pip install --no-use-pep517 cartopy.

[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (on the first coastline plot)

Cause: The first time Cartopy draws coastlines or borders it downloads map data from naturalearth.s3.amazonaws.com, and the Python environment cannot find usable root certificates.

Fix: Set SSL_CERT_FILE to the certificate file in your environment (for example ssl/cert.pem in a conda environment) and retry, or download the data manually and unzip it into ~/.local/share/cartopy/shapefiles/natural_earth.

What may come next: If your network cannot reach amazonaws.com, the download hangs and a manual download is the only way.

Scientify is a cloud computer with research software installed and AI agents such as Codex and Claude Code built in. Describe what you need in one sentence, for example "map this station temperature data over East China with coastlines", and the agent uses the preinstalled Cartopy to do the data processing and mapping, with no software to install and no code to write.

Compared with installing more on your own computer, the cloud computer already has Cartopy 0.26.0 with matching PROJ 9.9.0, GEOS 3.14.1, pyproj 3.8.0 and shapely 2.2.0, and runs continue after you close your laptop.

The cloud computer comes with more computing power: CPU and GPU clusters can be called on demand for large-scale scientific computing. Compute is billed by the minutes you actually use, so nothing is wasted.

Cloud computer
4 vCPU · 8 GB
Top configuration, for data processing and small to medium jobs
Callable GPU
96 GB VRAM
Up to an RTX PRO 6000 per GPU; H800 80 GB and up to 8 × A10G also available
Callable CPU
224 cores · 3 TB
Largest spec, for large parallel computations

References

Frequently asked questions

Should I install Cartopy with pip or conda?

conda is simpler: conda install -c conda-forge cartopy installs PROJ, GEOS and the other dependencies together. With pip, use 0.21 or later.

Why is the first coastline plot slow or failing?

Cartopy downloads Natural Earth data the first time it needs coastlines or borders, and fails if the network is blocked. After one download the data is cached locally.

Where is the downloaded map data stored?

By default in ~/.local/share/cartopy/shapefiles. To change it, set cartopy.config["data_dir"] after importing cartopy.

Make research maps with Scientify without setup

Upload your data, describe the computation, and Scientify runs it on a cloud computer that is already set up. New accounts get a free cloud computer and US$5 in credit.