[Pythonmac-SIG] Problems with GDAL on OSX

William Kyngesburye woklist at kyngchaos.com
Tue Feb 17 16:09:05 CET 2009

I guess I'll take a stab at this.  (I use my GDAL framework and python  
GDAL built from local source, not from easy_install.)

Do you have any form of GDAL installed?  The easy_install output isn't  
clear about if it found GDAL or not.  If it doesn't, it won't build  
the python extension, though you say it's there...  Maybe it will  
build it anyways, and hope that GDAL is found at runtime.

Another possibility is that it didn't install the compatibility python  
files.  The old GDAL python had everything at the root of the search  
path.  Now it's all in 'osgeo', so you should ge into the habit of  
importing like:

from osgeo import gdal

or even using a try/except to try both ways (see any of the GDAL  
python utility programs for an example).

Suggestion: try my GDAL framework - it comes with the python extension  
ready to use.  link in my sig.

On Feb 15, 2009, at 5:12 PM, Helly John J. wrote:

> Hi.
> I'm a newbie to python and am running:
> OS X 10.5.6
> Python 2.5.4
> and have run easy_install for gdal like this:
> /Library/Python/2.5/site-packages>sudo easy_install GDAL
> Password:
> Searching for GDAL
> Best match: GDAL 1.6.0
> Processing GDAL-1.6.0-py2.5-macosx-10.5-i386.egg
> GDAL 1.6.0 is already the active version in easy-install.pth
> Using /Library/Python/2.5/site-packages/GDAL-1.6.0-py2.5-macosx-10.5- 
> i386.egg
> Processing dependencies for GDAL
> Finished processing dependencies for GDAL
> However, when I run python and try to import gdal, this is what  
> happens:
> Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27)
> [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import gdal
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: No module named gdal
> >>>
> Clearly, it's not being found but I don't understand how to debug  
> this any further.  I have the *.egg in the site-packages directory  
> but don't understand if there is something else I have to do to make  
> it usable.  Any help would be much appreciated.

William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>

"We are at war with them. Neither in hatred nor revenge and with no  
particular pleasure I shall kill every ___ I can until the war is  
over. That is my duty."

"Don't you even hate 'em?"

"What good would it do if I did? If all the many millions of people of  
the allied nations devoted an entire year exclusively to hating the  
____ it wouldn't kill one ___ nor shorten the war one day."

<Ha, ha> "And it might give 'em all stomach ulcers."

- Tarzan, on war

More information about the Pythonmac-SIG mailing list