[gdal-dev] Building GDAL 1.7.3 Python bindings

Brian Wilson brian at wildsong.biz
Fri Dec 3 21:26:55 EST 2010


Greetings, I am looking for some suggestions on how to build the
python bindings for the latest gdal sources (1.7.3) for Windows.

Environment: Windows 7, Visual Studio 2010, Python 2.5
Success: building gdal itself
Failure: python module + bindings

I keep hitting dead ends getting Python set up. I am trying to include
details here because I searched and saw many "which version are you
using" messages... sorry for the verbosity.
I am not encountering ERROR messages, just trying to complete the
build process and get up to date python bindings.

I set up nmake.opt including PYDIR and PY_INST_DIR. I can't see
anywhere those are USED but I followed docs and set them
appropriately.  (C:\Python25)

And indeed, nothing pythonic appears to get built or installed. In
desperation I tried just copying the python stuff into site-packages
but of course that does not work, since there is no _gdal.dll built
and thus Python cannot find it.

I searched for hints on how to get there from here, but I only found a
few other people with similar problems.

I was able to build gdal with Visual Studio's "Build" command. I see
references to building from the command line, but I don't have a clue
how to do that in Windows. Something called nmake is referenced. I
have not marched down that road yet.

I got source code from http://trac.osgeo.org/gdal/wiki/DownloadSource

I looked at I looked at http://pypi.python.org/pypi/GDAL/ which has
lovely and usable Linux instructions but I am currently trapped in a
Windows world at my otherwise wonderful day job.
The text is duplicated in the source code under swig/python/Readme.txt

The link on that page suggesting that I download binaries jumps to the
old 1.5 version, but I can find this folder
http://download.osgeo.org/gdal/win32/1.7 which seems to have only a
couple plugins.
As a Linux person it seems very odd to drill down 3 levels into source
code only to find something like "Windows: go get the binaries
somewhere else".  Where do Windows binaries come from if they don't
get built ever?? So mysterious.

I suspect I need to do something with swig, which I downloaded and
installed, but the "Windows" notes basically say "you should never
have to do this". I don't know what I should never have to do, so that
is as far as I have gotten.

I can't use FWTools as they are built against an old version of Python
(2.3) and I am trying to work in an ESRI world which means I am using
2.5 and 2.6 and further I really would like to be able to build
support for file geodatabases to make this gdal python thing really
usable in my work.

I am sorry this email is long, but I have had plenty of time to work
on building GDAL today while waiting for fragile and slow ESRI tools
to run, really motivating me to try to use GDAL + Python.

(Did the geoprocess crash or is it just sloooooowwww... one never
knows with ESRI Model Builder.
OH! The process just FINISHED. Unreal. I had time to download and
build gdal itself a couple times while waiting. Now I can go back to
real work.)

Cheers --

Brian Wilson
Corvallis Oregon


More information about the gdal-dev mailing list