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

Christopher Barker Chris.Barker at noaa.gov
Fri Jun 25 12:53:21 EDT 2010


hannes wrote:
> How to compile gdal against a user specified numpy

I THINK the GDAL build calls python distutils (setup.py) to do the 
actual python extension build.

Ideally, the setup.py uses

numpy.get_include() to get the numpy include directory.

If so, it should "just work" with your setup, so I'd poke around and see 
if that's the case. If it is finding the numpy includes a different way, 
then that would explain your problem.

If it is set up this way, I'd track through the Python part of the 
build, and see how python is called, etc.

HTH,

-Chris



> 
> 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  
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov


More information about the gdal-dev mailing list