How to install Shapely on Anaconda Python (Windows)

By | January 29, 2015

How to Install Shapely on Anaconda (Windows)

Shapely is a Python package for analysis and manipulation of geometric objects.

Here’s how to install Shapely in the Anaconda python distribution, from Continuum Analytics.

Anaconda uses its ‘conda‘ package manager to install, remove and otherwise manage python packages. This generally works well, but in the case of Shapely the recommended install method is to download and install a ‘wheel‘ with pip.

Thankfully Anaconda also lets us install packages using pip.

Update: With thanks to a reader of this post your best option is probably to use plain anaconda:

conda install shapely

This seems to work fine now, so the rest of this post may be a useful starting point if you find that simple option does not work for you (for example if the version available on conda is not up to date)

Download the most recent Shapely ‘wheel’

The recommended install method for Shapely on windows is to download a .whl ‘wheel’ package: http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely

You’ll want to pick the right version of Python – you probably want version 2.7, but check your Anaconda distribution. You’ll also need to pick between 32- or 64-bit.

Install With Pip

Once you’ve downloaded the correct Shapely package, open up the ‘Anaconda Command Prompt’ and navigate to the folder containing the downloaded wheel.

To install run:

$ pip install Shapely‑1.5.5‑cp27‑none‑win32.whl

which will install shapely to somewhere like:

C:\Anaconda\Lib\site-packages\shapely

To check which packages you have already installed (with pip), run

$ pip list

or

$ pip freeze

Where to find examples

I was a bit surprised to find the examples folder to be rather bare.

If you want to get the full suite of examples, I suggest downloading the source from the project github repository: https://github.com/Toblerity/Shapely

python polygons