I'm trying to use Polygonizer plugin inside QGIS, but it needs Shapely to work. I've installed Shapely (pip install Shapely) but that's for python 2.7. QGIS works with python 2.6 (on Snow Leopard) and I can't find previous installers for it. Maybe I'm missing something?


2 Answers 2


I assume you are using the KyngChaos version of QGIS and thus the GEOS library is installed in /Library/Frameworks/GEOS.framework/

Download the Shapely Python package from PyPI or Shapely from github and untar.

Then, in the terminal:

cd -> shapely folder
LDFLAGS=`/Library/Frameworks/GEOS.framework/Versions/3/unix/bin/geos-config --libs`
CFLAGS=`/Library/Frameworks/GEOS.framework/Versions/3/unix/bin/geos-config --cflags` 
python setup.py install
  • Thanks gene. All your assumptions are correct. I did everything as you suggested, though used "sudo python setup.py install" instead. But it still installs it for python 2.7. "Installed /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Shapely-1.2.16-py2.7.egg"
    – Alex
    Jan 7, 2013 at 23:16
  • it is because you use the 2.7 version you have installed and not the installed version of Python on Snow Leopard which is 2.6. QGIS uses this version. It is a path problem
    – gene
    Jan 9, 2013 at 7:14

You basically have to use the corresponding versions of either easy_install or pip. Unless you installed pip in the Apple-supplied Python, it will only work with the 2.7 version (assuming you installed it there), so you must use easy_install. Try doing sudo /usr/bin/easy_install shapely, which will install shapely using the easy_install located in /usr/bin/.

Now, if you have updated your OS X to Lion or Mountain Lion, the Apple-supplied Python will be some earlier version of 2.7. Try uninstalling QGIS and then installing it again. I read somewhere that QGIS will recognize both 2.6 and 2.7 Apple-supplied Python versions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.