Python, GEOS and Shapely on Windows 64

geospatial, gis, python, shapely

Solution

Anaconda/Miniconda/Miniforge users should install Shapely (and dependencies) with:

conda install shapely

As of 2020, other Python users can install binary wheels from PyPI with pip:

pip install shapely

(you may need `--upgrade` to get at least version 1.7.0, when binary wheels were added.) Note that binary wheels are not available for Python 2 on Windows.

Another resource is Christoph Gohlke's Geospatial library wheels for Python on Windows releases on GitHub. Download the latest Shapely wheels from here, e.g., `shapely-2.0.1-cp39-cp39-win_amd64.whl` for 64-bit Python 3.9.

Problem

When trying to install Shapely on my Windows 64bit computer, I cannot get the GEOS library to work. So far, I have run the OSGeo4W installer from which I installed GDAL (I believe the geos library is included in that package). After that, I checked and I have geos_c.dll on my `C:\OSGeo4W\bin` directory, but either I have missed some configuration steps or the library does not work. I need Shapely to work, so I also ran `pip install shapely` after installing GDAL, and it apparently worked (although it could not find the C library for GEOS). In my code, I can import Shapely, but when I try to use it, I get an error telling me `"geos.dll"` is not found. Any help with this will be very appreciated. Thanks!

Original source

Related problems