4

I attempted to use GDAL without installing due to not having rights to install on this computer. I managed to get several gdal modules working, but when I attempted to use ReadAsArray() I received the import error

ImportError: No module named _gdal_array

I looked through the python folder and found that gdal and gdalconst both had pyd files and compiled files, but gdal_array does not.

When I ran VersionInfo() I got the value 1910 for gdal if that helps. I also have python 2.6 and numpy

Does anyone know a way I could fix this problem without using a gdal installer?

Dzinic
  • 273
  • 1
  • 4
  • 12
  • Are you on Windows? – ustroetz Jan 16 '14 at 01:07
  • @ustroetz Yes, Windows 7 – Dzinic Jan 16 '14 at 02:14
  • I have the same issue. Using the GDAL 64 bit version, the _gdal_array.pyd is NOT generated and when I call ReadAsArray() is returning the error: ImportError: No module named _gdal_array. Using the GDAL 32 bit version the _gdal_array.pyd file is generated and it is working. How can I solve it? Thanks –  Jan 27 '16 at 16:08
  • @Federico As I recall, I followed Lafleur's instructions that he posted in my other question (http://gis.stackexchange.com/questions/82977/is-it-possible-to-use-gdal-without-admin-rights/83297#83297) and it fixed it for me. – Dzinic Jan 28 '16 at 20:08

3 Answers3

5

This happens when numpy was not yet installed during the installation of gdal-python. This normally only affects folks who install using pip and install gdal before numpy. numpy is an optional build requirement and the package will install but quietly not include the _gdal_array component

To resolve, force a reinstall (rebuild of the package), via pip:

  1. pip install numpy
  2. pip install --force-reinstall gdal

or can be done using system package manager.

crasic
  • 203
  • 2
  • 7
3

Poking around I figured out that a bunch of gdal bundles are missing files, including the maptools.org ones. http://lists.osgeo.org/pipermail/gdal-dev/2011-May/028708.html

I found a gdal 1.10 version that is working for me. Put the install instructions with the original question: Is it possible to use GDAL without admin rights?

Lafleur
  • 131
  • 3
-2

In case you need gdal+python on windows x64, you should compile it manually.

Andrei
  • 9