I have brewed python 2.7.3 onto my Mac (Lion), and installed shapely via pip install shapely. The Polygonizer plugin, however, does not find the shapely library. I see when QGIS loads a Python console, it loads 2.7.1.

Do I need to brew QGIS to get it to play nicely with my other python libraries?

  • so what happens if you open the QGis Python console (plugins) and type in "import shapely" ? What version number ? Maybe the python path where you installed shapely was wrong.
    – Curlew
    Commented Feb 14, 2013 at 16:27
  • it says "no module called shapely." In my system console, it loads up without error. Commented Feb 14, 2013 at 16:32
  • 1
    I seem to have fixed the problem by uninstalling QGIS.app, and then running brew install qgis (after tapping homebrew/science). I guess the brewed python wasn't playing nice with the KyngChaos installer package. Commented Feb 14, 2013 at 16:33

1 Answer 1


The QGIS version of Kyngchaos uses exclusively the standard Python installed in Mac OS X and not those installed from Python.org, with Homebrew, MacPorts or Fink.

It is a problem of symbolic link in usr/bin. Normally the symbolic link of Python points to /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python When you install one of the versions listed, it changes this symbolic link in usr/bin.

As you have installed a new version of Python with Homebrew, pip will use this Homebrew version (in /usr/local/Cellar/python/2.7.3/bin) which is not used by QGIS (that will use the standard Python). Thus for QGIS, Shapely is not installed.

Therefore, it is a problem of PATH and you must modify the symlinks in usr/bin

I still do not understand why people install another version of Python 2.7 when there is already a version of Python 2.7 installed by default.

If you want to use the Python version of Homebrew, you must also use the QGIS version of Homebrew and not that of Kyngchaos.

In the same way, you will not be able to use Shapely in the Nightly Mac Build of QGIS from 'master' Branch from Larry Shaffer

  • Thanks for the explanation. The reason why I brewed python was to get quick access to pip and other updating tools. Brewing QGIS seems to have resolved the problem. Commented Feb 14, 2013 at 19:04
  • Why ? you can use pip and all that you want with the standard Python.
    – gene
    Commented Feb 14, 2013 at 19:33
  • Yes, but it's more complicated, and I'm not a real programmer. Commented Feb 14, 2013 at 19:38

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.