Bug report #8811

gdal_array python modules are missing from the Win64 QGIS 2.0.1-2 standalone installer

Added by Tim Sutton over 10 years ago. Updated over 10 years ago.

Status:Closed
Priority:Normal
Assignee:Jürgen Fischer
Category:Windows Package
Affected QGIS version:2.0.1 Regression?:No
Operating System:Windows Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:17508

Description

We are having problems running some python code that worked well in previous binary versions of QGIS. Example code below:

import gdal
fid = gdal.Open('tenbytenraster.asc', gdal.GA_ReadOnly)
band = fid.GetRasterBand(1)
array = band.ReadAsArray()

Under Lisboa, the code above runs fine. Under Dufour we get an error like this:

>>> import gdal
>>> id = gdal.Open('tenbytenraster.asc', gdal.GA_ReadOnly)
>>> fid = gdal.Open('tenbytenraster.asc', gdal.GA_ReadOnly)
>>> band = fid.GetRasterBand(1)
>>> array = band.ReadAsArray()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\\Program Files\\QGIS Dufour\\apps\\Python27\\lib\\site-packages\\osgeo\\gdal.py", line 1026, in ReadAsArray
    import gdalnumeric
  File "C:\\Program Files\\QGIS Dufour\\apps\\Python27\\lib\\site-packages\\osgeo\\gdalnumeric.py", line 1, in <module>
    from gdal_array import *
  File "C:\\Program Files\\QGIS Dufour\\apps\\Python27\\lib\\site-packages\\osgeo\\gdal_array.py", line 26, in <module>
    _gdal_array = swig_import_helper()
  File "C:\\Program Files\\QGIS Dufour\\apps\\Python27\\lib\\site-packages\\osgeo\\gdal_array.py", line 18, in swig_import_helper
    import _gdal_array
ImportError: No module named _gdal_array
>>>

After a bit of investigation, it seems that various python modules are missing in the Win Standalone installer. The attached image illustrates that that in the lisboa installation (on the left) gdal_array (and other) libs are present, whilst in Dufour they are absent.

Note: This problem may be present with the 32bit version of the installer too, we have not tested it yet.

liboa-vs-dufour.png (126 KB) Tim Sutton, 2013-10-09 06:22 AM

History

#1 Updated by Tim Sutton over 10 years ago

For more information, see also the downstream ticket from InaSAFE: https://github.com/AIFDR/inasafe/issues/674

#2 Updated by Jürgen Fischer over 10 years ago

Tim Sutton wrote:

For more information, see also the downstream ticket from InaSAFE: https://github.com/AIFDR/inasafe/issues/674

Try the OSGe4W4 installer - the standalone installer is not current (see also http://trac.osgeo.org/osgeo4w/ticket/379)

#3 Updated by Tim Sutton over 10 years ago

Hi

Yeah thanks we got it working with the OSGEO4W installer. It will be great to have those libs shipped with the standalone installer too.

Regards

Tim

#4 Updated by Jürgen Fischer over 10 years ago

  • Resolution set to fixed/implemented
  • Status changed from Open to Closed

fixed in 2.0.1-3.

Also available in: Atom PDF