[osgeo4w-dev] [osgeo4w] #590: wrong version of numpy installed with gdal-python

OSGeo4W trac_osgeo4w at osgeo.org
Thu Jan 24 03:11:20 PST 2019


#590: wrong version of numpy installed with gdal-python
----------------------------+----------------------------
Reporter:  monstermushroom  |       Owner:  osgeo4w-dev@…
    Type:  defect           |      Status:  closed
Priority:  major            |   Component:  Package
 Version:                   |  Resolution:  fixed
Keywords:                   |
----------------------------+----------------------------
Description changed by jef:

Old description:

> Hi,
>
> on a clean windows 32 bit build, if installing msys, gdal, gdal-python,
> python and python-numpy:
>
> open msys
>
> $ python
> Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32
> bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import numpy
> >>> from osgeo import gdal
> >>> from osgeo import gdalnumeric
> RuntimeError: module compiled against API version 0xc but this version of
> numpy is 0x7
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "C:\OSGeo4W\apps\Python27\lib\site-packages\osgeo\gdalnumeric.py",
> line 2, in <module>
>     from osgeo.gdal_array import *
>   File "C:\OSGeo4W\apps\Python27\lib\site-packages\osgeo\gdal_array.py",
> line 17, in <module>
>     _gdal_array = swig_import_helper()
>   File "C:\OSGeo4W\apps\Python27\lib\site-packages\osgeo\gdal_array.py",
> line 16, in swig_import_helper
>     return importlib.import_module('_gdal_array')
>   File "C:\OSGeo4W\apps\Python27\lib\importlib\__init__.py", line 37, in
> import_module
>     __import__(name)
> ImportError: No module named _gdal_array
> >>> exit()
>
> In OSGEo4w, the only option is to download python-numpy version 1.7.0,
> and the alternate version is 1.5, although these are very old, and the
> latest versions under osgeo seem to be 1.12 and 1.15.
>
> This appears to be because the python version is included in the file
> names of the older packets versions on the download site, making them
> seem as if they are newer.
> http://download.osgeo.org/osgeo4w/x86/release/python/python-numpy/
>
> python-numpy-1.11.0-1.tar.bz2   18-Oct-2017 20:37       5.3M
> python-numpy-1.12.1+mkl-1.tar.bz2       10-Apr-2017 11:41       17M
> python-numpy-1.12.1-1.tar.bz2   06-Apr-2017 08:14       5.4M
> python-numpy-1.15.4-1.tar.bz2   02-Jan-2019 17:38       7.6M
> python-numpy-2.5-1.1.0-1.tar.bz2        22-Jun-2008 20:12       2.4M
> python-numpy-2.7-1.5.1-1.tar.bz2        07-May-2011 08:08       2.1M
> python-numpy-2.7-1.7.0-1.tar.bz2        28-May-2013 15:10       2.4M
>
> The result of the error is that matplotlib and pandas will no longer
> function, since 1.7 is below their minimum versions, and also any script
> using gdal_calc, the gdal raster calculator, will also fail.
>
> Is there a workaround for this?  Can I make the setup look for the right
> version (which is probably 12?)
>
> Thanks,

New description:

 Hi,

 on a clean windows 32 bit build, if installing msys, gdal, gdal-python,
 python and python-numpy:

 open msys

 {{{
 $ python
 Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32
 bit (Intel)] on win32
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import numpy
 >>> from osgeo import gdal
 >>> from osgeo import gdalnumeric
 RuntimeError: module compiled against API version 0xc but this version of
 numpy is 0x7
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "C:\OSGeo4W\apps\Python27\lib\site-packages\osgeo\gdalnumeric.py",
 line 2, in <module>
     from osgeo.gdal_array import *
   File "C:\OSGeo4W\apps\Python27\lib\site-packages\osgeo\gdal_array.py",
 line 17, in <module>
     _gdal_array = swig_import_helper()
   File "C:\OSGeo4W\apps\Python27\lib\site-packages\osgeo\gdal_array.py",
 line 16, in swig_import_helper
     return importlib.import_module('_gdal_array')
   File "C:\OSGeo4W\apps\Python27\lib\importlib\__init__.py", line 37, in
 import_module
     __import__(name)
 ImportError: No module named _gdal_array
 >>> exit()
 }}}

 In OSGEo4w, the only option is to download python-numpy version 1.7.0, and
 the alternate version is 1.5, although these are very old, and the latest
 versions under osgeo seem to be 1.12 and 1.15.

 This appears to be because the python version is included in the file
 names of the older packets versions on the download site, making them seem
 as if they are newer.
 http://download.osgeo.org/osgeo4w/x86/release/python/python-numpy/

 {{{
 python-numpy-1.11.0-1.tar.bz2   18-Oct-2017 20:37       5.3M
 python-numpy-1.12.1+mkl-1.tar.bz2       10-Apr-2017 11:41       17M
 python-numpy-1.12.1-1.tar.bz2   06-Apr-2017 08:14       5.4M
 python-numpy-1.15.4-1.tar.bz2   02-Jan-2019 17:38       7.6M
 python-numpy-2.5-1.1.0-1.tar.bz2        22-Jun-2008 20:12       2.4M
 python-numpy-2.7-1.5.1-1.tar.bz2        07-May-2011 08:08       2.1M
 python-numpy-2.7-1.7.0-1.tar.bz2        28-May-2013 15:10       2.4M
 }}}

 The result of the error is that matplotlib and pandas will no longer
 function, since 1.7 is below their minimum versions, and also any script
 using gdal_calc, the gdal raster calculator, will also fail.

 Is there a workaround for this?  Can I make the setup look for the right
 version (which is probably 12?)

 Thanks,

--

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


More information about the osgeo4w-dev mailing list