I am trying to run Shapely on a new machine, and tried both installing it from source, using the installer on its webpage, and using pip install shapely. Every reference I try to make from the library except from shapely import * throws the error WindowsError: [Error 126] The specified module could not be found. Has anyone had a similar experience when trying to leverage Shapely, and figure out how to get it to function correctly?

Python Error Thrown:
WindowsError: [Error 126] The specified module could not be found

Windows 7 64-bit
Python 2.7


You're doing your installation wrong.

Instead of

pip install shapely

go to https://pypi.org/project/Shapely/#built-distributions to see you can download Windows wheels at https://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely

On the second link, click on the file Shapely‑1.6.4.post1‑cp35‑cp35m‑win_amd64.whl

Shapely‑1.6.4 is the version of Shapely, cp35‑cp35m means the wheel is for Python 3.5, win_amd64 means it's for Windows with 64 bits architecture (you may choose another wheel depending on your Python version and Windows architecture)

Launch the install with the following and it will be OK after.

pip install Shapely‑1.6.4.post1‑cp35‑cp35m‑win_amd64.whl

Just as an information, "pip install shapely" works when you have the C compiler installed to build Geos dll and it's not the way it works on Windows.


Try using Conda-Forge

conda config --add channels conda-forge 
conda install shapely

Error 126 indicates that some dependent DLL can not be found. Presumably, this is because Shapely can not find GEOS.

Try using the install from pypi: LINK.

Not the answer you're looking for? Browse other questions tagged or ask your own question.