Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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. Is there a way to change this? Do I need to brew QGIS to get it to play nicely with my other python libraries?

share|improve this question
    
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 Feb 14 '13 at 16:27
    
it says "no module called shapely." In my system console, it loads up without error. –  gregmacfarlane Feb 14 '13 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. –  gregmacfarlane Feb 14 '13 at 16:33

1 Answer 1

up vote 3 down vote accepted

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

share|improve this answer
    
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. –  gregmacfarlane Feb 14 '13 at 19:04
    
Why ? you can use pip and all that you want with the standard Python. –  gene Feb 14 '13 at 19:33
    
Yes, but it's more complicated, and I'm not a real programmer. –  gregmacfarlane Feb 14 '13 at 19:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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