I know there are a number of similar questions, but none of them have answers that allow me to use shapely in QGIS. In particular I am trying to install the Contour plugin, but this fails with the message "The plugin depends on some components missing on your system. You need to install the following Python module in order to enable it: shapely.geometry." The reason for this error is explained well here: How to install the Python module shapely for QGIS use?
These are the steps I have taken to solve the issue:
I first installed shapely via pip. This allowed me to import shapely in python 2.7, which is the default on my system, but installing the plug in still failed with the same error.
This question How to install shapely for python 2.6 (Mac) NOT 2.7? explained that qgis uses python 2.6, not 2.7, so I downloaded the tar file and did a sudo python2.6 setup.py install. Now I can import shapely in python 2.6 too.
But the installation of the plugin still fails with the same warning! I've also tried import shapely from the python console within QGIS, and there is "no module named shapely." Is there something I've overlooked?
EDIT. Thanks to the comments from gene below, it turns out that QGIS on Lion does use python 2.7, not 2.6. But still it doesn't work. It turns out though that I have a few different versions of 2.7:
From the terminal:
$ python
Python 2.7.2 (default, Mar 8 2012, 15:29:59)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
From the QGIS python console:
>>> import sys
>>> print sys.version
2.7.1 (r271:86832, Jun 16 2011, 16:59:05)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)]
>>>
From the terminal again:
$ python2.7
Python 2.7.3 (default, Oct 22 2012, 06:12:32)
[GCC 4.2.1 Compatible Apple Clang 3.1 (tags/Apple/clang-318.0.58)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
So it seems that QGIS uses 2.7.1, Apple defaults to 2.7.2, and I also have 2.7.3. So I need to install shapely for 2.7.1?
from shapely.geometry import Pointin the Terminal. – gene Jun 25 '13 at 06:32import shapelydoes,import shapely.geometrydoes not. (though that shouldn't matter right?) – EddyTheB Jun 25 '13 at 15:20import shapelyandprint shapely.__file__in your terminal – gene Jun 25 '13 at 16:26