Opened 5 years ago

Closed 3 years ago

#588 closed defect (outdated)

gdal_merge.bat Runtime Error. QGIS 3.4.3 Standalone Installers for 32 and 64 bit Windows systems

Reported by: gabrieldeluca Owned by: osgeo4w-dev@…
Priority: major Component: Package
Version: Keywords: qgis-3 gdal-merge numpy

Description (last modified by jef)

On clean installs of the QGIS 3.4.3 Standallone Installers for 32 and 64 bit builds for Windows systems, the GDAL Merge tool produces images with only zero values in all pixels when the result is saved to a temporary file (if not, the merged file is well generated but the command output is the same).


Processing algorithm…
Algorithm 'Merge' starting…
Input parameters:
{ 'DATA_TYPE' : 5, 'INPUT' : ['D:/test/merge/S44E170.hgt','D:/test/merge/S44E171.hgt'], 'NODATA_INPUT' : None, 'NODATA_OUTPUT' : None, 'OPTIONS' : '', 'OUTPUT' : 'C:/Users/Gabriel/AppData/Local/Temp/processing_6e5c1804cb924bf882b2ccc82074d4cc/3b8fd4e987774e5fb55ea11a62d9420c/OUTPUT.tif', 'PCT' : False, 'SEPARATE' : False }

GDAL command:
cmd.exe /C gdal_merge.bat -ot Float32 -of GTiff -o C:/Users/Gabriel/AppData/Local/Temp/processing_6e5c1804cb924bf882b2ccc82074d4cc/3b8fd4e987774e5fb55ea11a62d9420c/OUTPUT.tif --optfile C:/Users/Gabriel/AppData/Local/Temp/processing_6e5c1804cb924bf882b2ccc82074d4cc\mergeInputFiles.txt
GDAL command output:
0RuntimeError: module compiled against API version 0xc but this version of numpy is 0xa

Traceback (most recent call last):

File "C:\PROGRA~1\QGIS3~1.4\bin\", line 611, in <module>


File "C:\PROGRA~1\QGIS3~1.4\bin\", line 596, in main

fi.copy_into(t_fh, band, band, nodata)

File "C:\PROGRA~1\QGIS3~1.4\bin\", line 343, in copy_into


File "C:\PROGRA~1\QGIS3~1.4\bin\", line 124, in raster_copy


File "C:\PROGRA~1\QGIS3~1.4\bin\", line 180, in raster_copy_with_mask

t_xsize, t_ysize)

File "C:\PROGRA~1\QGIS3~1.4\apps\Python27\lib\site-packages\osgeo\", line 2635, in ReadAsArray

from osgeo import gdalnumeric

File "C:\PROGRA~1\QGIS3~1.4\apps\Python27\lib\site-packages\osgeo\", line 2, in <module>

from osgeo.gdal_array import *

File "C:\PROGRA~1\QGIS3~1.4\apps\Python27\lib\site-packages\osgeo\", line 17, in <module>

_gdal_array = swig_import_helper()

File "C:\PROGRA~1\QGIS3~1.4\apps\Python27\lib\site-packages\osgeo\", line 16, in swig_import_helper

return importlib.import_module('_gdal_array')

File "C:\PROGRA~1\QGIS3~1.4\apps\Python27\lib\importlib\", line 37, in import_module


ImportError: No module named _gdal_array

Execution completed in 1.81 seconds
{'OUTPUT': <QgsProcessingOutputLayerDefinition {'sink':C:/Users/Gabriel/AppData/Local/Temp/processing_6e5c1804cb924bf882b2ccc82074d4cc/3b8fd4e987774e5fb55ea11a62d9420c/OUTPUT.tif, 'createOptions': {'fileEncoding': 'System'}}>}

Loading resulting layers
Algorithm 'Merge' finished

Manually solved from the OSGeo4W.bat (as Administrator) shell:

C:\Windows\System32>python -m pip install -U numpy
Collecting numpy
  Using cached
Installing collected packages: numpy
  Found existing installation: numpy 1.12.1+mkl
    Uninstalling numpy-1.12.1+mkl:
      Successfully uninstalled numpy-1.12.1+mkl
Successfully installed numpy-1.15.4

After that, Merge tool works fine and without error logs.

Tested with the builds:

in Windows 7 and Windows 10, with the following data:

Reports found: SE Getting black square after merging two rasters in QGIS

QGIS #20835

Change History (7)

comment:1 by gabrieldeluca, 5 years ago


comment:2 by jef, 5 years ago

Description: modified (diff)
Summary: gdal_merge.bat Runtime Error. QGIS 3.4.3 Standallone Installers for 32 and 64 bit Windows systemsgdal_merge.bat Runtime Error. QGIS 3.4.3 Standalone Installers for 32 and 64 bit Windows systems

comment:3 by vesnikos, 5 years ago

This also affects the normal execution of any gdal/python (i.e gdal_calc) from the osgeo console.

Installing previous versions of numpy from the console doesn't solve the problem.

comment:4 by jef, 5 years ago

Resolution: fixed
Status: newclosed

comment:5 by Andreas Müller, 5 years ago

I have the same error now with python-numpy 2.7-1.7.0-1 and gdal 2.4.1-1. QGIS is 3.4.9 and 3.8.0, 32 bit

EDIT: Today, tested with 3.4.10, still does not work. Some processing tools fail too.

Last edited 5 years ago by Andreas Müller (previous) (diff)

comment:6 by Andreas Müller, 5 years ago

Resolution: fixed
Status: closedreopened

See my comment above...

comment:7 by jef, 3 years ago

Resolution: outdated
Status: reopenedclosed
Note: See TracTickets for help on using tickets.