[gdal-dev] gdal compile from svn for python - how to specify a user defined numpy directory for compilation

hannes gisxperts at web.de
Fri Jun 25 10:16:57 EDT 2010


Question:

How to compile gdal against a user specified numpy


1) I got the latest SVN from numpy and scipy and compiled into user
specific directory using --prexif=mydir. numpy test are all sucessfull,
scipy shows two errors.
 
Specified 
export PYTHONPATH='/media/work/hannes/lib/python2.6/site-packages'
so my python installation always loads the user specified numpy and
scipy first. 

2) Download the latest stable 1.7.2 gdal from svn and compiled to the
same directory using 

export LD_LIBRARY_PATH=/media/work/hannes/lib:$LD_LIBRARY_PATH
./configure --prefix=/media/work/hannes --libdir=/media/work/hannes
make
make install --prefix=/media/work/hannes
## made a try without specifying --libdir 

go into python  
Python 2.6.4 (r264:75706, Dec  7 2009, 18:43:55) 
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> print numpy.__version__
2.0.0.dev8464
>>> from osgeo import gdal_array
RuntimeError: module compiled against version 1000009 of C-API but this
version of numpy is 2000000
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File
"/media/work/hannes/lib/python2.6/site-packages/osgeo/gdal_array.py",
line 7, in <module>
    import _gdal_array
ImportError: numpy.core.multiarray failed to import
>>> exit()

I seem to miss the switch to tell it to use a local numpy for gdal !!! 
Any advice ? (BTW, import numpy.core.multiarray diretly in python works)

Which switch do I miss here, probably somewhere in ./configure ? 


Hannes

PS. I regenerate the python swig bindings using make etc, still does not
help. 

Comment1: 
If I remember correctly ./configure -with--python  reported to screen
that the python-gdal files are written to the default installation
directory and not to the --prefix dir, but did not save the screen
output for that error message.. sorry  









More information about the gdal-dev mailing list