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


4 Answers 4


Updated answer for Python 3

You should not nowadays encounter any issue while installing on Windows using (as long as pip is version 8 or more according to official Shapely doc and you are using Python 3):

pip install shapely

To check pip version, do :

python -c "import pip;print(pip.__version__)"

If you need to upgrade pip, just do :

pip install -U pip

Outdated if Python 3 otherwise, always relevant for Python 2.x

You're doing your installation wrong.

Instead of

pip install shapely

go to https://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely to download Windows wheels

Click on the file Shapely‑1.6.4.post2‑cp27‑cp27m‑win_amd64.whl

Shapely‑1.6.4 is the version of Shapely, cp27‑cp27m means the wheel is for Python 2.7, 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.post2‑cp27‑cp27m‑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.

  • This answer is old, as pip install shapely now works as you'd expect it to.
    – Mike T
    Commented Jan 31, 2020 at 0:59
  • For Linux and Mac maybe but for Windows, the official docs seem to confirm it remains relevant e.g pypi.org/project/Shapely/#built-distributions (PS: nearly never open Windows nowadays so maybe missing something)
    – ThomasG77
    Commented Jan 31, 2020 at 1:44
  • Yes Windows too. Read the second paragraph of the article you just linked.
    – Mike T
    Commented Jan 31, 2020 at 1:57
  • Thanks. Read again and... You are right!
    – ThomasG77
    Commented Jan 31, 2020 at 3:14
  • Just tried it on Py 2.7 and appears to be broken
    – Geordie
    Commented Jun 1, 2020 at 10:31

As of 2020, the recommended method to install Shapely is simply:

pip install shapely

(this will not work for Windows + Python 2.7, as these binary wheels are not available)

However, if you are using Python from Anaconda (or Miniconda), you should stick to their version with:

conda install shapely
  • I found that the latest version of shapely still has issues when installed along with GEOS at least on macOS. The solution when not using Conda is to (re)install using pip and the --no-binary Shapely option github.com/Toblerity/Shapely/issues/416
    – Jacopofar
    Commented Oct 12, 2020 at 10:21

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.