I cannot install the cartopy package when using the ! pip install cartopy
function in Jupyter. I have also tried several alternative functions like ! pip install Cartopy-0.20.2-cp38-cp38-win_amd64.whl
and ! conda install cartopy
and ! conda install -c conda-forge cartopy
and !pip install --global-option=build_ext --global-option="-I C:UsersMy NameAppDataRoamingPythonPython310Scripts" --global-option="-L C:UsersMy NameAppDataRoamingPythonPython310Scripts" cartopy
. I have also installed all the packages required like geos
, proj
and cython
but still had no success.
I tried everything that I discussed in details section, and I always get this error message:
Building wheels for collected packages: cartopy
Building wheel for cartopy (pyproject.toml): started
Building wheel for cartopy (pyproject.toml): finished with status 'error'
Failed to build cartopy
error: subprocess-exited-with-error
Building wheel for cartopy (pyproject.toml) did not run successfully.
exit code: 1
[286 lines of output]
<string>:90: UserWarning: Unable to determine GEOS version. Ensure you have 3.7.2 or later installed, or installation may fail.
(286 lines of output)
fatal error C1083: Cannot open include file: 'geos_c.h': No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\cl.exe' failed with exit code 2
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for cartopy
ERROR: Could not build wheels for cartopy, which is required to install pyproject.toml-based projects
2
Answers
Installation
Conda pre-built binaries
The easiest way to install Cartopy is by using
Conda <https://conda.io/miniconda.html>
_. If conda is already installed,installation is as easy as::
Other pre-built binaries
Additional pre-built binaries can be found at a variety of sources, including:
maintains unofficial Windows binaries of cartopy.
OSGeo Live <https://live.osgeo.org>
_.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::
To instead install the most recent version found on the GitHub main branch,
use::
Alternatively, you can clone the git repo on your computer and install manually
using the
setup.py
file::Required dependencies
To make the most of Cartopy by enabling additional functionality, you may want
to install these optional dependencies.
GDAL version 2.3.2 (https://gdal.org/)
GDAL is a translator library for raster and vector geospatial data formats,
which has powerful data transformation and processing capabilities.
Pillow 6.1.0 or later (https://python-pillow.org)
A popular fork of PythonImagingLibrary.
pykdtree 1.2.2 or later (https://github.com/storpipfugl/pykdtree)
A fast kd-tree implementation that is used for faster warping
of images than SciPy.
SciPy 1.3.1 or later (https://www.scipy.org/)
A Python package for scientific computing.
OWSLib 0.18 (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 (https://github.com/Toblerity/Fiona)
A Python package for reading shapefiles that is faster than pyshp.
Testing Dependencies
On my experiments,I remembered a package update alert based on microsoft visual c 14 during cartopy module installation!!(By the way,I must express that my module folder has satisfied requirements for geospatial analysis😐)So,I summary that installations as microsoft visual c 14 can cause a risk for your individual geospatial env😐Thus,I will suggest an alternative solution cartopy👍