GDAL on 64-bit Linux

0 views
Skip to first unread message

tr81we...@gmail.com

unread,
Mar 19, 2014, 3:18:19 PM3/19/14
to anac...@continuum.io
I just installed Anaconda 1.9.1 on a 64-bit Linux system running Scientific Linux release 6.5 (Carbon).  I used all of the defaults.  I successfully installed GDAL using conda.  As has been reported by other users, I'm getting the "ImportError: No module named _gdal_array" issue:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/home/nobody/anaconda/lib/python2.7/site-packages/IPython/utils/py3compat.pyc in execfile(fname, *where)
    202             else:
    203                 filename = fname
--> 204             __builtin__.execfile(filename, *where)

/blah/plot_nitf.py in <module>()
     27
     28 # 3.
---> 29 arr = geo.ReadAsArray()
     30 #plt.imshow(arr[:3,:,:].transpose((1, 2, 0)))
     31 #plt.show()

/home/nobody/anaconda/lib/python2.7/site-packages/osgeo/gdal.pyc in ReadAsArray(self, xoff, yoff, xsize, ysize, buf_obj)
    779
    780     def ReadAsArray(self, xoff=0, yoff=0, xsize=None, ysize=None, buf_obj=None ):
--> 781         import gdalnumeric
    782         return gdalnumeric.DatasetReadAsArray( self, xoff, yoff, xsize, ysize, buf_obj )
    783     def WriteRaster(self, xoff, yoff, xsize, ysize,

/home/nobody/anaconda/lib/python2.7/site-packages/osgeo/gdalnumeric.py in <module>()
----> 1 from gdal_array import *
      2 from numpy import *

/home/nobody/anaconda/lib/python2.7/site-packages/osgeo/gdal_array.py in <module>()
     23                 fp.close()
     24             return _mod
---> 25     _gdal_array = swig_import_helper()
     26     del swig_import_helper
     27 else:

/home/nobody/anaconda/lib/python2.7/site-packages/osgeo/gdal_array.py in swig_import_helper()
     15             fp, pathname, description = imp.find_module('_gdal_array', [dirname(__file__)])
     16         except ImportError:
---> 17             import _gdal_array
     18             return _gdal_array
     19         if fp is not None:

ImportError: No module named _gdal_array


On Windows using the 32-bit version of Anaconda 1.9.1, the same version of GDAL works.  Poking around on my Linux system, I found that the vendor-supplied GDAL Python package includes the following *gdal_array* files:

/usr/lib64/python2.6/site-packages/osgeo/gdal_array.pyc
/usr/lib64/python2.6/site-packages/osgeo/_gdal_array.so
/usr/lib64/python2.6/site-packages/osgeo/gdal_array.pyo
/usr/lib64/python2.6/site-packages/osgeo/gdal_array.py

However, the Anaconda installation contains only the .pyc and .py files:

./pkgs/gdal-1.10.1-py27_0/lib/python2.7/site-packages/osgeo/gdal_array.py
./pkgs/gdal-1.10.1-py27_0/lib/python2.7/site-packages/osgeo/gdal_array.pyc
./lib/python2.7/site-packages/osgeo/gdal_array.py
./lib/python2.7/site-packages/osgeo/gdal_array.pyc

Thus, it seems as though the Linux .so (and .pyo?) file wasn't built or included in the Anaconda GDAL package.  As I am not using a personally owned system, software installation for me is generally a long and involved process.  I, and the other GDAL users, would greatly appreciate it if Continuum could rectify this GDAL issue.

Ilan Schnell

unread,
Mar 19, 2014, 9:56:56 PM3/19/14
to Anaconda
Thanks for reporting this problem.  As I understand, _gdal_array.so is
an optional extension to better interact with numpy arrays.
I've tried adding numpy as a build dependency to the conda-recipe,
but that by itself didn't cause _gdal_array.so to get built.  Are there
some other configure options which might be required?
The current conda-recipe for building GDAL is here:
https://github.com/conda/conda-recipes/tree/master/gdal

Thanks   Ilan


--
Anaconda Community Support Group Brought to you by Continuum Analytics
---
You received this message because you are subscribed to the Google Groups "Anaconda - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to anaconda+u...@continuum.io.
To post to this group, send email to anac...@continuum.io.
Visit this group at http://groups.google.com/a/continuum.io/group/anaconda/.

Ilan Schnell

unread,
Mar 20, 2014, 1:20:33 PM3/20/14
to Anaconda
I figured out the problem.  You can to get the new build of GDAL, use:
$ conda update gdal

- Ilan

tr81we...@gmail.com

unread,
Mar 20, 2014, 1:21:50 PM3/20/14
to anac...@continuum.io
Thanks for looking into this.  I've never built GDAL from sources, so I don't know what configure options might be required. I've always installed (or had installed for me) the packages from the Linux vendor, or used the binary installers on Windows (OSGeo4W, QGIS).  As I mentioned, I poked around to see which _gdal_array files were present in other installations.  I noticed that the Anaconda 32-bit Windows GDAL package has _gdal_array.pyd files, in addition to the gdal_array.py and gdal_array.pyc files, so there must be some additional options that were not selected for the Linux build.  Either that, or the Linux build has external dependencies that were unmet.  The GDAL Pypi page, https://pypi.python.org/pypi/GDAL/1.10.0, lists libgdal and gdel-dev header files packages as dependencies, FWIW.

tr81we...@gmail.com

unread,
Mar 21, 2014, 9:36:26 AM3/21/14
to anac...@continuum.io
YES!! That fixed it.  Thank you very much.

vita...@gmail.com

unread,
Feb 26, 2015, 11:02:36 PM2/26/15
to anac...@continuum.io
What did you do to fix this? I'm attempting to create a conda package with a very particular GDAL configuration for our cluster, but I'm currently missing gdal_array functionality. 

Thanks,
Andrew

rich....@gmail.com

unread,
May 6, 2015, 5:06:36 PM5/6/15
to anac...@continuum.io
So I don't have conda on rhel6; I installed from the tarball and still get this issue from the trunk of the gdal repository tree.

What was the fix for this when I'm using the latest code on the trunk?

Richard


On Thursday, March 20, 2014 at 10:20:33 AM UTC-7, Ilan wrote:

Andrew Vitale

unread,
May 6, 2015, 5:10:03 PM5/6/15
to anac...@continuum.io
The solution I ended up using was with Conda. If you can Conda, this is a really simple set of instructions that seems to run without error:


Best of luck,
Andrew

You received this message because you are subscribed to a topic in the Google Groups "Anaconda - Public" group.
To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/anaconda/PpkPALUJOxA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to anaconda+u...@continuum.io.

To post to this group, send email to anac...@continuum.io.
Visit this group at http://groups.google.com/a/continuum.io/group/anaconda/.



--
Andrew P. Vitale
Staff Research Scientist
Desert Research Institute
2215 Raggio Pkwy
Reno, NV 89512

rich....@gmail.com

unread,
May 7, 2015, 7:42:52 PM5/7/15
to anac...@continuum.io, vita...@gmail.com
This solved my problem after installing 'conda' on my machine.

Thanks!

Richard
Reply all
Reply to author
Forward
0 new messages