Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OSError: Could not find lib geos_c.dll or load any of its variants ['..\Library\\lib\\geos_c.dll']

I'm having trouble with geos lib in python. I'm using an anaconda venv with Python 3.6 on Windows 10. On one computer, it is running. So I exported the venv and installed the venv on another computer (which worked). But on the other computer, the same code is not running. I'm using geos 3.8.0 and shapely 1.6.4. When I run the code, I get the following error:

*File "..\lib\site-packages\shapely\coords.py", line 8, in <module>
    from shapely.geos import lgeos
  File "..\lib\site-packages\shapely\geos.py", line 130, in <module>
    os.path.join(sys.prefix, "Library", "lib", "geos_c.dll"),
  File "..\lib\site-packages\shapely\geos.py", line 56, in load_dll
    libname, fallbacks or []))
OSError: Could not find lib geos_c.dll or load any of its variants ['..\\Library\\lib\\geos_c.dll']*

I already tried:

  • to reinstall the packages with conda-forge
  • use other versions e.g.: geos 3.7.1 and shapely 1.7.0
  • copied the geos_c.dll from ..\Library\bin (where it actually exists) to \Library\lib\
  • changed the os.path.join in geos.py to os.path.join(sys.prefix, "Library", "bin", "geos_c.dll")

Does anyone know, how to fix this problem so that I can run the code on both computers?

Thanks in advance!

like image 224
PHOFF Avatar asked Jan 19 '26 15:01

PHOFF


1 Answers

I got rid of the problem with installing the packages geos and shapely at base environment in anaconda. Maybe it helps someone else

like image 54
PHOFF Avatar answered Jan 22 '26 12:01

PHOFF



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!