Install Shapely: OSError: [WinError 126] The specified module could not be found
Asked Answered
B

5

25

I have to install Shapely package (http://toblerity.org/shapely/project.html#installation). But when I am using:

pip install Shapely

I am getting this error:

Collecting Shapely
  Using cached Shapely-1.5.17.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\AppData\Local\Temp\pip-build-mwuxcain\Shapely\setup.py", line 38, in <module>
        from shapely._buildcfg import geos_version_string, geos_version, \
      File "C:\Users\AppData\Local\Temp\pip-build-mwuxcain\Shapely\shapely\_buildcfg.py", line 200, in <module>
        lgeos = CDLL("geos.dll")
      File "C:\Users\Anaconda3\lib\ctypes\__init__.py", line 344, in __init__
        self._handle = _dlopen(self._name, mode)
    OSError: [WinError 126] The specified module could not be found

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\AppData\Local\Temp\pip-build-mwuxcain\Shapely\

And, when I am using:

conda install shapely

I am getting this error:

Fetching package metadata ...........


PackageNotFoundError: Package not found: Conda could not find '

I am using Python 3.6.0 (Anaconda3) on Windows 10 (64-bit).

Please help. (nothing works)

Buhler answered 6/6, 2017 at 19:24 Comment(4)
conda install shapely -- pip rarely works for things like this on windowsRondon
@PaulH Thanks. I have updated the question.Buhler
sorry, you might need to pull it from the conda-forge channel: conda install shapely --channel=conda-forgeRondon
@PaulH You could make that an answer.Goldshlag
B
25

Download WHL file using http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely

Install:

python -m pip install Shapely-1.5.17-cp36-cp36m-win_amd64.whl

Ubuntu:

pip install shapely==1.6b2
Buhler answered 6/6, 2017 at 19:58 Comment(0)
T
6

You can also use

conda install -c conda-forge shapely

It worked for me.

Torrens answered 25/1, 2020 at 6:51 Comment(0)
J
1

pip install shapely was not working but conda install shapely worked fine for me (windows user)

Joell answered 31/1, 2021 at 23:19 Comment(0)
M
0

Solution which worked for me (Windows Server):

  1. Install osgeo4w from https://trac.osgeo.org/osgeo4w/

  2. copy geos_c.dll and geos.dll to C:\ProgramData\Anaconda3\Library\bin

Mooring answered 25/9, 2020 at 17:52 Comment(0)
S
0

https://www.programmersought.com/article/70235795361/

copy "[env path]\LIb\site-packages\shapely\DLLs\geos*.dll" to "[env path]\Library\bin"
Sternmost answered 2/7, 2021 at 6:11 Comment(1)
While the code might answer he question ,we cant trust the content in the link to do so. Could you append this answer with an explanation on what your snipped does?Emlyn

© 2022 - 2024 — McMap. All rights reserved.