[gdal-dev] _gdal_array not found

Jorge Arévalo jorge.arevalo at deimos-space.com
Fri Oct 29 07:46:09 EDT 2010


2010/10/29 Jorge Arévalo <jorge.arevalo at deimos-space.com>:
> 2010/10/29 Even Rouault <even.rouault at mines-paris.org>:
>> Jorge,
>>
>> WriteArray() needs the gdal-numpy module to be built. So ensure you have numpy
>> and numpy-devel packages installed (or whatever they are named on your distro)
>> when rebuilding the GDAL python bindings. I guess you lack the numpy-devel
>> package that is necessary for building and probably not installed if you've just
>> installed the packaged version.
>>
>
> Hi Even,
>
> Thanks for the fast responde. That sounds very logic. I built numpy
> from sources too (numpy 1.5.0) so, what should I do if I want the
> development packages? I did a
>
> python setup.py build --fcompiler=gnu95
> python setup.py install
>
> Isn't it enough?
>
> BTW, I found that
> http://download.opensuse.org/repositories/home:/ashigabou/SLE_10/x86_64/.
> I think I'll try it with these packages...
>
>

Update: these packages, as I supposed, were compiled for the default
suse 10.2 python installation (/usr/lib64/python2.4), just the one
that works. So, I can't use them :-(


>>> Hi,
>>>
>>> I'm using Python 2.7, with GDAL 1.7.2 bindings. Piece of code:
>>>
>>> (...)
>>> dst_ds = raster.Create( tiff, tiff_width, tiff_height, 4, gdal.GDT_Byte)
>>> (...)
>>> zeros = numpy.zeros( (tiff_height, tiff_width), numpy.uint8 )
>>> dst_ds.GetRasterBand(1).WriteArray( zeros )
>>> (...)
>>>
>>> In the "WriteArray" line, I get this exception:
>>>
>>> File "myFile.py", line 389, in createBlankRasters
>>>     dst_ds.GetRasterBand(1).WriteArray( zeros )
>>>   File "/usr/local/lib/python2.7/site-packages/osgeo/gdal.py", line
>>> 898, in WriteArray
>>>     import gdalnumeric
>>>   File "/usr/local/lib/python2.7/site-packages/osgeo/gdalnumeric.py",
>>> line 1, in <module>
>>>     from gdal_array import *
>>>   File "/usr/local/lib/python2.7/site-packages/osgeo/gdal_array.py",
>>> line 25, in <module>
>>>     _gdal_array = swig_import_helper()
>>>   File "/usr/local/lib/python2.7/site-packages/osgeo/gdal_array.py",
>>> line 17, in swig_import_helper
>>>     import _gdal_array
>>> ImportError: No module named _gdal_array
>>>
>>> Ok, the file _gdal_array.py doesn't exist. But this code works with
>>> Python 2.4 and GDAL 1.6.0 in the same machine (Suse Enterprise 10.2
>>> x86_64).
>>>
>>> Comparing the contents of the
>>> /usr/local/lib/python2.7/site-packages/osgeo/ directory with the
>>> contents of the equivalent directory of the other version of Python
>>> (/usr/lib/python2.4/site-packages/GDAL-1.6.0-py2.4-linux-x86_64.egg/osgeo/),
>>> I find several files missing in the newer one (2.7). Files like
>>> "_gdal_array.py", "_gdal_array.pyc", "_gdalconst.py",
>>> "_gdal_array.so", "_gdalconst.so", "_gdal.py", "_gdal.pyc",
>>> "_gdal.so", and so on. All the missing files starting with "_"
>>>
>>> The newer installation (2.7) was created from sources, building python
>>> 2.7 and GDAL 1.7.2 (with "configure --with-python && make && make
>>> install"). The previous installation (2.4) was created from package
>>> manager (Suse YaST).
>>>
>>> I've looking for the missing files in another directories, but they
>>> don't exist. I suppose they weren't compiled, but why? If they're no
>>> longer neded with GDAL 1.7.2, why is python 2.7 asking for them? I
>>> need the code to work in this new version. Any clues?
>>>
>>> Many thanks in advance,
>>>
>>> --
>>> Jorge Arévalo
>>> Internet & Mobilty Division, DEIMOS
>>> jorge.arevalo at deimos-space.com
>>> http://mobility.grupodeimos.com/
>>> http://gis4free.wordpress.com
>>> _______________________________________________
>>> gdal-dev mailing list
>>> gdal-dev at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>>
>>
>>
>>
>
>
>
> --
> Jorge Arévalo
> Internet & Mobilty Division, DEIMOS
> jorge.arevalo at deimos-space.com
> http://mobility.grupodeimos.com/
> http://gis4free.wordpress.com
>



-- 
Jorge Arévalo
Internet & Mobilty Division, DEIMOS
jorge.arevalo at deimos-space.com
http://mobility.grupodeimos.com/
http://gis4free.wordpress.com


More information about the gdal-dev mailing list