Trying to import gdal for Python 2.7.3 on Windows XP:

>>> import gdal
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\gdal.py", line 2, in <module>
    from osgeo.gdal import deprecation_warn
  File "C:\Python27\lib\site-packages\osgeo\__init__.py", line 21, in <mo
    _gdal = swig_import_helper()
  File "C:\Python27\lib\site-packages\osgeo\__init__.py", line 17, in swit_helper
  _mod = imp.load_module('_gdal', fp, pathname, description)
ImportError: DLL load failed: The specified procedure could not be found.

Following suggestions from Installing GDAL with Python on windows? and elsewhere, here's what I've done so far:

The result is the same. Any other ideas about how to troubleshoot this?

  • Did you install Python using OSGeo4W? – Nathan W Dec 31 '12 at 5:41
  • gdal19.dll is not in your path. Edit the environment variable and try again. Also, you should use the import: from osgeo import gdal. – user10353 Dec 31 '12 at 15:43
  • @NathanW I had not - I installed 2.7.2 and tried again - no change. – meetar Dec 31 '12 at 16:26
  • @kyle gdal19.dll is in C:\OSGeo4W\bin which is in my path, and the result is the same when I try from osgeo. – meetar Dec 31 '12 at 16:28
  • Are you sure the versions match up for your python bindings and your osgeo install? I don't use windows that much. Can you check your gdal version to be sure it's 1.9.2: gdalinfo --version – user10353 Dec 31 '12 at 17:47

Condensed procedure outlined in http://cartometric.com/blog/2011/10/17/install-gdal-on-windows/ for Windows 7, 32 Bits, to install GDAL PYTHON:

1) Install Python.

I installed Python 2.7.9 from https://www.python.org/

2) Install the GDAL binaries published by Tamas Szekeres.

First, I launched IDLE (Python GUI) noting the following values: "MSC v.1500" and "on win32":

enter image description here

In this link: http://www.gisinternals.com/release.php

Click in the magenta link of the below image:

enter image description here

Click in the magenta links of the below image for download and install gdal-111-1500-core.msi and GDAL-1.11.1.win32-py2.7.msi:

enter image description here

3) Append your environment Path variable

enter image description here

enter image description here

After click in Edit and search for Path, add:

;C:\Program Files\GDAL

DON'T FORGET the ; character before C:\Prog... and click OK three times:

enter image description here

4) Add the GDAL_DATA environment variable (one click in New for each variable: gdal-data and gdalplugins)

DON'T FORGET click OK three times:

enter image description here

enter image description here

5) Finally, perform a quick test to make sure everything worked.

Launch IDLE (Python GUI) and type from osgeo import gdal [Enter]:

enter image description here

I didn't get gdal ImportError in python on my Windows 7 system.

Note: import gdal is deprecated.

| improve this answer | |
  • I have tried with all above explained methods but it show error like this: ImportError: DLL load failed: The specified procedure could not be found. – Shiuli Pervin Sep 9 '16 at 8:24
  • I know that this method works for 7 and 8 Windows systems and python 2.7 with 32 bits. If you have different conditions you should carefully read in each link those that match in your own system. – xunilk Sep 9 '16 at 8:37
  • Thanks!I have recently windows 10 and I am screwed up. I installed in my office several computers it worked perfectly but not at home it is not working at all. I am hang up for several hours. Do you have any idea about it? – Shiuli Pervin Sep 9 '16 at 9:16
  • 1
    Same boat as you, @ShiuliPervin. It's a joke... so difficult to install this. I have literally spent all day trying to get gdal installed. Ridiculous! Apparently, though, you can do this with scipi hydro.washington.edu/~jhamman/hydro-logic/blog/2013/10/12/… as well as python-netcdf4 – pookie Nov 5 '16 at 21:44
  • I meant netcdf4-python: netcdf4-python github.com/Unidata/netcdf4-python – pookie Nov 5 '16 at 21:52

I recommend to place the path to GDAL in the PATH variable BEFORE(!!) the python path. In this way you avoid the fact that python can not find the necessary gdal.dlls

| improve this answer | |

Similarly, I placed

C:\Program Files (x86)\GDAL;

at the very first in the Path of System Variables. Issue solved after 1 day of searching the web. Using Python 2.7.10, 32 bit, Windows 8.

| improve this answer | |
  • This solved my problem completely! I had Arc Desktop installed first and then installed gdal without an issue once I did this. – MoreMeowbell Mar 21 at 4:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.