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.

It seems that MacPorts installs Python27 in /opt/local, but that MacPorts QGIS updates and uses the Apple Python27 in /Library. The result is that MacPorts additions to Python27 such as OpenCV don't work because they are added to the /opt/local Python27 whereas with QGIS installed all Python links point to the /Library Python27 so things like OpenCV can't be used. Has anyone found a way of keeping QGIS working while either 1. making it use the MacPorts Python27 at /opt/local, or 2. enabling MacPorts to add things to the /Library Python27?

The MacPorts people agree it's a problem, but are focussed on finding a 100% MacPorts solution (none yet after 5 months); they aren't interested in cooperating with the native QGIS or Apple Python. I've no response from the OpenCV people as to whether it can be linked to the /Library Python27. (Not being a Unix guru, I'd prefer to stay with MacPorts if that's possible.)

share|improve this question

1 Answer 1

use the QGIS version of Kyng Chaos and no more problem:

  • it uses the Apple Python (2.6 in Snow Leopard, 2.7 in the Lions's)
  • it does not install anything that is already installed on Mac OS X (Python, etc.), like MacPorts.
  • there are no problems of PATH:

In addition:

  • the Path problems arise because the original build script of QGIS is made for the Apple Python
  • the great majority of users do not know what is MacPorts and do not use it.
  • if the people who want to use QGIS had to install MacPorts, I think it would have no success.
  • and finally, the majority of the QGIS developers on Mac use the principles of Kyng Chaos (native frameworks, etc.) and not MacPorts

if you still want to use MacPorts, the only solution is to modify the build script (adjusting the paths) and compile yourself.

The Homebrew version of QGIS do not have this problem (see Getting QGIS working on Homebrew):

brew remove pyqt
brew install pyqt #verify everything works fine
# fix the path of Python
export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH
brew tap homebrew/science
brew install qgis --with-grass --with-postgis

I can understand that some like MacPorts but I still do not understand why people want to use MacPorts or Homebrew when there is a native solution (Python, QGIS, etc.).

In addition, the master versions of QGIS available at Dakota Cartography use the Kyng Chaos distribution, not MacPorts or Homebrew (same for the GRASS GIS version 6.5 and 7 available at Michael Barton)

share|improve this answer
    
To clarify: Kyng Chaos QGIS AND MacPorts QGIS screw up MacPorts installation of OpenCV and other Python extensions that don't seem to be available any other way. That's why I included option 2. above - to find a way of adding Python extensions to the Apple Python so Python can be used independently of QGIS. –  johnsankey Apr 2 '13 at 22:41
    
Try placing the Python modules in the site-packages folder of the Apple Python. Personally I compiled myself OpenCv without MacPorts and Apple Python can be used independently of QGIS –  gene Apr 3 '13 at 9:47
    
or adding the site-package folder of the MacPorts Python to the PYTHONPATH of the Apple Python - import sys; sys.path.insert(0,'/opt/.../site-packages') –  gene Apr 3 '13 at 10:15
    
Placing the MacPorts opencv modules into the Apple Python crashes it. ...egg-info is a single file in MacPorts Python but a whole directory full of stuff in Apple Python. –  johnsankey Apr 3 '13 at 12:12
    
Compiling OpenCV directly into Apple Python sounds the safest route. I've found the opencv-unix dowbnload package (...bz2). Where do I get precise instructions to do that? I know very little about Unix. –  johnsankey Apr 3 '13 at 12:16

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.