Problems with OS X 10.5.6 and Python 2.5 and GDAL 1.6

Philip Semanchuk philip at semanchuk.com
Thu Feb 19 13:07:28 EST 2009


On Feb 19, 2009, at 12:30 PM, Helly John J. wrote:

> Hi Philip.
> I installed the 2.5.4 binary from the python.org site.  I did this  
> because NumPy and SciPy currently only work with 2.5 and the system  
> version was 2.4.

It looks like you're using the same Python at the command line as the  
Python to which you installed GDAL. There shouldn't be anything else  
you have to do once easy-install is complete.

As Miles pointed out, you should probably try this:
from osgeo import gdal

instead of this:
import gdal

Although I gather the latter should work based on the documentation  
here:
http://trac.osgeo.org/gdal/wiki/GdalOgrInPython#imports

I can't see what went wrong with your installation.

You can try an uninstall and reinstall. (`easy_install -m GDAL` might  
do the uninstall for you.) If you're feeling adventurous, you can try  
to unwind the installation by hand. Edit easy-install.pth and delete  
the line that refers to GDAL, and then blow away the GDAL directory in  
site-packages.

I see that you originally ran the easy_install from the directory '/ 
Library/Python/2.5/site-packages'. Don't do that. I don't have a  
logical reason for why, but Python given that the current directory is  
part of Python's import search path, you might be giving easy_install  
a different "environment" than your regular Python session. It's just  
a shot in the dark, but worth a try.

Sorry I couldn't be of more help.




> On Feb 17, 2009, at 12:30 PM, Philip Semanchuk wrote:
>
> On Feb 16, 2009, at 8:35 PM, Helly John J. wrote:
>
>> Hi.
>>
>> I'm a newbie to python and am running:
>>
>> OS X 10.5.6
>> Python 2.5.4
>
> Hi John,
> Are you using the system Python or have you installed another version?
>
> Cheers
> Philip
>
>
>
>
>>
>>
>> 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.
>> Cheers.
>> --------------
>> John Helly, University of California, San Diego
>> San Diego Supercomputer Center,  Mail Code 0527
>> Scripps Institution of Oceanography, Climate, Atmospheric Science,  
>> and Physical Oceanography, Mail Code 0224
>> 9500 Gilman Dr., La Jolla CA 92093
>> +01 760 840 8660 mobile / stonesteps (Skype) / stonesteps7  
>> (iChat) / URL (http://www.sdsc.edu/~hellyj)
>>



More information about the Python-list mailing list