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
Environment:
Windows 7 64-bit
Python 2.7
Answer
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://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.
No comments:
Post a Comment