Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python, GEOS and Shapely on Windows 64

Tags:

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!

like image 597
Juan Carlos Coto Avatar asked Oct 30 '12 17:10

Juan Carlos Coto


People also ask

Do I need to install PIP?

PIP for Python is a utility to manage PyPI package installations from the command line. If you are using an older version of Python on Windows, you may need to install PIP.

Is shapely open source?

Shapely is a BSD-licensed Python package for manipulation and analysis of planar geometric objects. It is using the widely deployed open-source geometry library GEOS (the engine of PostGIS, and a port of JTS).


2 Answers

Anaconda/Miniconda 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 for Windows users with Python installed from python.org, Christoph Gohlke maintains an excellent pool of Unofficial Windows Binaries for Python. Download the Shapely wheels for 32- or 64-bit versions of Python, which includes GEOS dependencies.

like image 60
Mike T Avatar answered Oct 02 '22 01:10

Mike T


see my answer here https://stackoverflow.com/a/50623996/1683626

on windows 10, python 3.6.5 64bit

  • install osgeo4w
  • add installed folder to path e.g. C:\OSGeo4W64\bin (must contain geos_c.dll)
  • restart command line
like image 37
Jozef Cechovsky Avatar answered Oct 02 '22 00:10

Jozef Cechovsky