[gdal-dev] Problem importing osgeo module in Python

Roger André randre at gmail.com
Fri Aug 8 12:46:14 EDT 2008


Hi everyone,

I'm getting a new machine setup and have hit a snag with the GDAL
installation.  I've installed GDAL from source onto a CentOS box using the
gdal-1.5.2.tar.gz file, and with the following parameters:

$ sudo ./configure --prefix=/export --with-pg=/export/bin/pg_config
--with-python
$ make
$ make install
$ which gdalinfo
    /export/bin/gdalinfo
--> Good!

The problem comes when I try to import the osgeo module in Python.

$ python
Python 2.3.4 (#1, Dec 11 2007, 05:28:55)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from osgeo import gdal
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: No module named osgeo
--> Not good.

Looking back through the make output, I see that the osgeo modules are being
created and copied:
    copying build/lib.linux-x86_64-2.3/osgeo/gdal.py ->
/export/lib64/python2.3/site-packages/osgeo

So I tried appending the location to the sys.path in Python to make the
modules available, but am only partially succesful with that:
[root at randre-linux ~]# python
Python 2.3.4 (#1, Dec 11 2007, 05:28:55)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.append('/export/lib64/python2.3/site-packages/')
>>> import osgeo
--> Good!

>>> from osgeo import gdal
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/export/lib64/python2.3/site-packages/osgeo/gdal.py", line 7, in ?
    import _gdal
ImportError: libgdal.so.1: cannot open shared object file: No such file or
directory
--> Not good.

So I'm guessing that my gdal libs aren't accessible for some reason, but I'm
just guessing.  Is there a way that I can fix this at the ./configure stage?


Thanks,

Roger
--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20080808/fc527540/attachment.html


More information about the gdal-dev mailing list