Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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 How to install 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?

share|improve this question
    
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. –  kyle 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 –  kyle Dec 31 '12 at 17:47

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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