[GIS] Python module “shapely.wkb” missing

pythonqgisqgis-pluginsshapely

I am trying to follow a tutorial from here http://qgistips.spatialthoughts.com/2012/12/find-neighbor-polygons-in-layer-in-qgis.html#more

I have downloaded the relevant python script and edited it as required. When I try to run the script using the Python console in QGIS >Plugins>Python Console I get the following error message.

ImportError: No module named shapely.wkb
Start of relevant script

from PyQt4.QtCore import *
from shapely.wkb import loads
# Replace the below value with the field containing name or id of the feature
# For example, if your field is called name then change the line below to
# name_filed = 'name'

The module shapely.wkb is called on the second line of the script so the failure appears to be occurring as the second line of code is executed.

I have searched for a Python module with that name in Plugins>Fetch Python Modules
Is this something that needs to be installed separately? From what I have read it should be installed with an installation of PostGis which I though got loaded when I used StackBuilder to install PostGreSQL.

Would installing installing Python 2.7.3 on my MAC Book Pro help?

Best Answer

You probably missed the step where you installed shapely. Aptitude (sudo apt-get install reference) is not compatible on Mac for many reasons, none I of which I will get into.

This Shapely For MAC

should get you there.

Also, I suspect you already have a version for python on your MAC, but it might be old. Shapely requires version 2.5 and you might be under it.

Install Python For MAC

will tell you how to test your version and how to upgrade.

Related Question