[gdal-dev] ImportError with Python 2.6 and VS 2008

Gregory, Matthew matt.gregory at oregonstate.edu
Wed Oct 27 15:11:17 EDT 2010

Hi all,

I apologize if this specific issue has been addressed before.  I've checked the listserve and didn't see anything right off.  I'm sure I'm doing something stupid ...

Previously, I had been compiling GDAL from trunk using VS2005 (VC8) and Python 2.5.  I've recently gone to Python 2.6 (32-bit) on a Windows 7 64-bit box and have tried to compile with VS 2008 (VC9) (also 32-bit).  Here are the steps I took:

* Updated from SVN
* Rebuilt Release version of gdal_svn using makegdal90.
* cd to "swig" and run "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat"
* Ran "nmake /f makefile.vc python"
* cd to "swig\python" and ran "python setup.py install'

The C++ build seems to work fine and I get the expected outputs.  The Python install also seems to work correctly and puts the expected files into site-packages.  But I get this error message in Python:

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

I've gotten these issues before when I haven't matched the correct version of Python against Visual Studio, but I *think* I've avoided those problems here.  I did notice that 'makefile90.vcproj' is using MSVC_VER=1400 in the make tool command lines.  I tried switching these to MSVC_VER=1500 to no avail. 

Any help is greatly appreciated.


More information about the gdal-dev mailing list