Does anyone have an updated step by step guide on how to install GDAL to work with Python?
I've searched on Google and GIS stack exchange and all of the tips seem outdated as I have not gotten gdal to work when I try to import it in Python.
Any tips from anyone who has successfully installed GDAL recently?
Thanks.
My computer details:
ArcMap 10.3.1
Python 2.7.8 32 bit
Windows 7 SP1 64 bit
Solved! Go to Solution.
Hi all,
I finally got it to work.
Thanks for your initial help anyway.
The problem I was having was that a lot of the instructions kept saying things like find the bin folder or other folders that didn't exist in my downloads.
If anyone needs help installing GDAL in 2016, this post from GIS stack exchange worked for me: (scroll down to the bottom to find the post by xunilk)
gdal ImportError in python on Windows - Geographic Information Systems Stack Exchange
When you installed it, where did you place it?
What install site did you get it from (there are many)?
If you are using an arcgis distribution of python, then your python paths are not conventional.
In any event, I assume that you installed the 32bit version for python 2.7 any more details would help
For a repackaged version of Cristoph Gohlke's Unofficial GDAL Python bindings built against numpy 1.9 with the ECW and MrSID plugins included you can try:
pip install --user -i https://pypi.anaconda.org/luke/channel/np19/simple gdal
Luke... I got wondering about this statement on the site
The binaries are compatible with the official CPython distribution on Windows >=6.0. Chances are they do not work with custom Python distributions included with Blender, Maya, ArcGIS, OSGeo4W, ABAQUS, Cygwin, Pythonxy, Canopy, EPD, Anaconda, WinPython etc. Many binaries are not compatible with Windows XP or Wine.
So the pip you posted is yours I presume for python 2.7?
Dan, Gohlke's stuff that I've tried works fine with ArcGIS installed python 2.7. There are a few gotchas though, mainly to do with C extension version compatibility. The version I repackaged is built against numpy 1.9 so should work with ArcGIS 10.3
For numpy 1.7 (i.e an ArcGIS 10.1 or 10.2 python installation)
pip install -i https://pypi.anaconda.org/luke/channel/np17/simple gdal
This is only tangentially related, but seems relevant to this thread. I installed GDAL 1.11.3 on ArGIS 10.3.1, it works fine. BUT when I run a script that used to run under under 10.2, I now get the following error:
Traceback (most recent call last):
[...]
File "C:\Python27\ArcGIS10.3\lib\site-packages\osgeo\gdal.py", line 1176, in ReadAsArray
import gdalnumeric
File "C:\Python27\ArcGIS10.3\lib\site-packages\osgeo\gdalnumeric.py", line 1, in <module>
from gdal_array import *
File "C:\Python27\ArcGIS10.3\lib\site-packages\osgeo\gdal_array.py", line 26, in <module>
_gdal_array = swig_import_helper()
File "C:\Python27\ArcGIS10.3\lib\site-packages\osgeo\gdal_array.py", line 22, in swig_import_helper
_mod = imp.load_module('_gdal_array', fp, pathname, description)
ImportError: numpy.core.multiarray failed to import
From what I gather, the error comes from a mismatch between the updated GDAL installation and the numpy version (1.7.1) that was installed with ArcGIS. The reason I post this here is that Luke mentioned installing numpy 1.9... I have read in other fora that this might not work with Arc, has anyone tried it? Is it better to update numpy or downgrade GDAL?
I don't have ArcGIS 10.3. Can you confirm that 10.3 still install numpy 1.7x?
Don't try and install numpy 1.9 if so, you can break arcpy stuff, use the numpy 1.7 specific version of the gdal bindings I referred to.
pip install -i https://pypi.anaconda.org/luke/channel/np17/simple gdal
Indeed, the ArcGIS Python gives this
>>> numpy.version.version
'1.7.1'
but I may have done something weird with the install, as it sounds it should have been 1.9...
In any case, I resolved the issue by installing the previous version of GDAL.
Thanks!
Hi all,
I finally got it to work.
Thanks for your initial help anyway.
The problem I was having was that a lot of the instructions kept saying things like find the bin folder or other folders that didn't exist in my downloads.
If anyone needs help installing GDAL in 2016, this post from GIS stack exchange worked for me: (scroll down to the bottom to find the post by xunilk)
gdal ImportError in python on Windows - Geographic Information Systems Stack Exchange