[Osgeo4w-trac] [osgeo4w] #588: gdal_merge.bat Runtime Error. QGIS 3.4.3 Standallone Installers for 32 and 64 bit Windows systems

OSGeo4W trac_osgeo4w at osgeo.org
Fri Jan 4 22:30:12 PST 2019


#588: gdal_merge.bat Runtime Error. QGIS 3.4.3 Standallone Installers for 32 and
64 bit Windows systems
--------------------------+-------------------------------------
Reporter:  gabrieldeluca  |      Owner:  osgeo4w-dev@…
    Type:  defect         |     Status:  new
Priority:  major          |  Component:  Package
 Version:                 |   Keywords:  qgis-3 gdal-merge numpy
--------------------------+-------------------------------------
 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).

 Log:
 {{{
 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\gdal_merge.py", line 611, in <module>

 sys.exit(main())

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

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

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

 nodata_arg)

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

 m_band)

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

 t_xsize, t_ysize)

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

 from osgeo import gdalnumeric

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

 from osgeo.gdal_array import *

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

 _gdal_array = swig_import_helper()

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

 return importlib.import_module('_gdal_array')

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

 __import__(name)

 ImportError: No module named _gdal_array

 Execution completed in 1.81 seconds
 Results:
 {'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
 https://files.pythonhosted.org/packages/74/a4/1bae5948ac37ee6769ffdf01fef3e1c731981574d4d416e2876070441688/numpy-1.15.4-cp27
 -none-win_amd64.whl
 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:

 [http://download.osgeo.org/qgis/windows/QGIS-
 OSGeo4W-3.4.3-1-Setup-x86.exe]

 [http://download.osgeo.org/qgis/windows/QGIS-OSGeo4W-3.4.3-1-Setup-
 x86_64.exe]

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

 [https://dds.cr.usgs.gov/srtm/version2_1/SRTM3/Islands/S44E170.hgt.zip]

 [https://dds.cr.usgs.gov/srtm/version2_1/SRTM3/Islands/S44E171.hgt.zip]

 ----

 Reports found:

 [https://gis.stackexchange.com/questions/307195/getting-black-square-
 after-merging-two-rasters-in-qgis/307284#307284]

 [https://issues.qgis.org/issues/20895]

-- 
Ticket URL: <https://trac.osgeo.org/osgeo4w/ticket/588>
OSGeo4W <http://trac.osgeo.org/osgeo4w>
OSGeo4W is the Windows installer and package environment for the OSGeo stack.


More information about the Osgeo4w-trac mailing list