6

When I run the command:

from shapely.geometry import LineString

I get this error:

Could not find module 'C:\Users\SWWB\Anaconda\Library\bin\geos_c.dll' (or one of its dependencies). Try using the full path with constructor syntax.

How can I solve it?

Gary Strivin'
  • 908
  • 7
  • 20
Roger
  • 61
  • 1
  • 1
  • 2
  • Does this answer your question? [OSError geos\_c could not be found when Installing Shapely](https://stackoverflow.com/questions/12578471/oserror-geos-c-could-not-be-found-when-installing-shapely) – Georgy Dec 17 '20 at 18:32
  • unfortunately not – Roger Dec 17 '20 at 19:30
  • And what about the answers here [Could not find library geos_c or load any of its variants](https://stackoverflow.com/q/19742406/7851470)? – Georgy Dec 18 '20 at 10:00

4 Answers4

11

I run into this same problem. I am using Pycharm on Windows 10 with a conda environment. I used pip to install the packages in my requirements.txt file.

I am using Shapely which depends on geos. It seems pip did not install that dependency, so what I did was to first remove Shapely with:

pip uninstall shapely

Then, I used conda to install the package (geos gets installed too), and everything works fine.

conda install shapely

I think if you use pip, you can just install geos individually if it is not installed (I did not test):

pip install geos
Ahmed Ktob
  • 2,874
  • 1
  • 11
  • 15
2

I had similar problem. I reinstalled shapely using conda.

Use the following

conda install shapely
Dharman
  • 30,962
  • 25
  • 85
  • 135
SJa
  • 487
  • 4
  • 14
0

If you tryed to reinstall shapely. But it didn't work. Maybe you could try to install pygeos using following command. It works to me.

pip install pygeos
TAN
  • 43
  • 6
0
  1. Find out your whether you are using Windows 32-bit or 64-bit. Go to Settings => System => About => System Type.
  2. Find out your python version. Open Command prompt, enter python --version and remember the first two numbers. For example my version is Python 3.7.3 so I should remember the number 37.
  3. pip install wheel
  4. Go here and download the wheel corresponding to items 1–2. For example, I have 64-bit OS and Python 3.7.3 so I need to download file Shapely-1.6.4.post2-cp37-cp37m-win_amd64.whl
  5. pip install <filename_from_item_4> . For example in my case I entered pip install C:\Users\Dalya\Downloads\Shapely-1.6.4.post2-cp37-cp37m-win_amd64.whl
  6. restart the python kernel

copied from here: https://towardsdatascience.com/install-shapely-on-windows-72b6581bb46c

MrZH6
  • 227
  • 1
  • 5
  • 16