[GIS] QGIS can’t find osgeo after GDAL upgrade

gdalmacqgis

Mac OS 10.6.8: I installed QGIS 1.8.0 with GDAL 1.8; then another app requires GDAL 1.9 and installed it; now QGIS can't find osgeo [python-gdal]. (I can't find any trace of GDAL 1.8 left in my system.)

What needs to be edited to point QGIS to GDAL 1.9?

Best Answer

If you install QGIS 1.8.0 from KyngChaos and QGIS 1.9 from Nightly Mac Build of QGIS from 'master' Branch, they need the same version of GDAL (the 1.9 version of Kynchaos, not the 1.8) and you need to understand some Principles of Mac OSX:

And all the versions of GDAL are installed in this folder

The symbolic link Current points to the version used (the last one, 1.9 here) by QGIS (1.8 and 1.9) and the GRASS GIS version of Kyngchaos (6.4.2) and the experimental builds of Michael Barton (6.4.3, 6.5 and 7)

  • osgeo is a Python module. Each version of GDAL in the Framework has its own version of osgeo (/Library/Frameworks/GDAL.framework/Versions/1.9/Python/, /Library/Frameworks/GDAL.framework/Versions/1.8/Python, etc.) but only the latest version is used.

The link with the modules of the standard Python (in /Library/Python/2.6/site-packages/ for 10.6.8) is made by a .pth file

enter image description here

The content of this file is

import sys; sys.path.insert(0,'/Library/Frameworks/GDAL.framework/Versions/1.9/Python/2.6/site-packages')

That adds osgeo to the sys.path of the standard Python

enter image description here

If you really want use the 1.8 version, simply change the contents of this file to

import sys; sys.path.insert(0,'/Library/Frameworks/GDAL.framework/Versions/1.8/Python/2.6/site-packages')

enter image description here

Related Question