16

I'm trying to use shapley, and to use it for what I need it for, I have to import "from shapely import geometry" but I get the error OSError: Could not find lib geos_c.dll

I've tried to install "geos" via "pip install geos", didn't do anything: Requirement already satisfied

pip location: C:\Users\skoft\AppData\Local\Programs\Python\Python37-32\Scripts\pip.exe

import shapely

from shapely import geometry

OSError: Could not find lib geos_c.dll or load any of its variants ['C:\\Users\\skoft\\AppData\\Local\\Programs\\Python\\Python37-32\\Library\\lib\\geos_c.dll'].
Aviv Yaniv
  • 6,188
  • 3
  • 7
  • 22
  • "pip install geos", didn't do anything what do you mean? error? didn't work? on windows pip is located in "scripts" subdir. – Jean-François Fabre Jun 28 '19 at 20:52
  • well, it didn't solve anything, and I'm not sure it's even related to this error I just tried something –  Jun 28 '19 at 20:56
  • can you type `where pip` and post the results? – Jean-François Fabre Jun 28 '19 at 21:00
  • C:\Users\skoft\AppData\Local\Programs\Python\Python37-32\Scripts\pip.exe –  Jun 28 '19 at 21:00
  • damn that looks okay. And what is the output of `pip install geos` ? can you [edit] your question for that? – Jean-François Fabre Jun 28 '19 at 21:03
  • Requirement already satisfied: geos in c:\users\skoft\appdata\local\programs\python\python37-32\lib\site-packages (0.2.2) Requirement already satisfied: flask in c:\users\skoft\appdata\local\programs\python\python37-32\lib\site-packages (from geos) (1.0.3) Requirement already satisfied: lxml in c:\users\skoft\appdata\local\programs\python\python37-32\lib\site-packages (from geos) (4.3.4) Requirement already satisfied: pillow in c:\users\skoft\appdata\local\programs\python\python37-32\lib\site-packages (from geos) (6.0.0) –  Jun 28 '19 at 21:04
  • sounds like a bug in shapely: search the dll in c:\users\skoft\appdata\local\programs\python\python37-32\lib\site-packages and if you found it, copy it in 'C:\\Users\\skoft\\AppData\\Local\\Programs\\Python\\Python37-32\\Library\\lib\\geos_c.dll' – Jean-François Fabre Jun 28 '19 at 21:08
  • well I found a folder called geos and pasted it into lib, did not work. did not find any dll –  Jun 28 '19 at 21:23
  • Did you check here [Could not find library geos_c or load any of its variants](https://stackoverflow.com/questions/19742406/could-not-find-library-geos-c-or-load-any-of-its-variants)? – Georgy Jul 01 '19 at 13:00

5 Answers5

1

On python 3.8.5 and windows 10. I meet the same error. Then conda install shapely solved the problem for me.

sun
  • 183
  • 1
  • 5
1

I got the same error. My import statement (from shapely.geometry import Point) successfully executed after I manually downloaded the geo_c.dll file from https://www.dll-files.com/geos_c.dll.html and placed it in the bin folder "C:\Users....\Anaconda3\Library\bin".

Abhiram
  • 498
  • 2
  • 3
  • 11
1

In my case, it decided to install Visual C++ for Visual Studio 2015, because debugging the site-packages\shapely\geos.py file I noticed that the dll is being found but not loaded. Finally checking the geos_c.dll file dependencies I saw that it needed MSVCP140.DLL

1

I had the same issue in Python 3.6 with Windows 10 in the Shapely library. I have downloaded the geos_c.dll file online and replaced it in the shapely dll folder that is in environment library. Replacement DLL folder

env\Lib\site-packages\shapely\DLLs

Download Link:

download geos_c.dll online, then put it into your lib address. it works for me

Sumit Kumar Gupta
  • 2,132
  • 1
  • 22
  • 21
0

On python 3.6.5. and windows 10, installing GDAL through osgeo4w project and adding C:\OSGeo4W64\bin to the PATH variable solved the problem for me.

Najiva
  • 142
  • 8