GeoDjango - GDAL library giving error

Darwin Tech picture Darwin Tech · Feb 1, 2012 · Viewed 7.3k times · Source

I am trying to get GeoDjango running on ubuntu and have hit a problem with GDAL.

I have downloaded and installed GDAL without problem.

I had to add the following line to my project settings:

GDAL_LIBRARY_PATH = '/usr/local/lib/libgdal.so.1.15.1'  

When I check in the shell all is good:

In [1]: from django.contrib.gis import gdal
In [2]: gdal.HAS_GDAL
Out[2]: True

However when I try and run ogrinfo as in the official tutorial I get the following error:

$ ogrinfo world/data/TM_WORLD_BORDERS-0.3.shp
ogrinfo: error while loading shared libraries: libgdal.so.1: cannot open shared object file: No such file or directory

GDAL files are located at:

/usr/local/lib/libgdal.a
/usr/local/lib/libgdal.la
/usr/local/lib/libgdal.so
/usr/local/lib/libgdal.so.1
/usr/local/lib/libgdal.so.1.15.1

libgdal.so and libgdal.so.1 both symlink to libgdal.so.15.1

Any help would be much appreciated.

Answer

Darwin Tech picture Darwin Tech · Feb 2, 2012

So, for the record, the answer was to add the library path /usr/local/lib/ to /etc/ld.so.conf, then run $ sudo ldconfig