Could not find module (or one of its dependencies). Try using the full path with constructor syntax

Viewed 18067

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?

4 Answers

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

I had similar problem. I reinstalled shapely using conda.

Use the following

conda install shapely

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
  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

Related