[gdal-dev] Can't make Python binding work
Christopher Barker
Chris.Barker at noaa.gov
Sun Dec 12 12:19:54 EST 2010
Martin Hvidberg wrote:
> To start with the problem... In a new python file I write:
> When run it replies:
>
> Traceback (most recent call last):
>
> _File "C:\Martin\Work_Eclipse\Hilfe\src\check_GDAL.py", line 8, in
> <module>_
>
> import gdal
>
> ImportError: No module named gdal
>
>
> To me that translates into, Python can't find the GDAL modules.
correct.
> I using GDAL from http://pypi.python.org/pypi/GDAL/
On that site, it says: "GDAL Python Bindings available at the Python
Cheeseshop. An executable installer is available for both Python 2.4 or
2.5 or as a Python egg."
but I don't see any Windows binaries for the python bindings, and that
note doesn't include 2.6 anyway, i suspect it hasn't been updated for a
while -- we really should have python 2.6 and 2.7 there, as well as GDAL
1.7.*
> I downloaded http://download.osgeo.org/gdal/win32/1.6/gdalwin32exe160.zip
That is the binaries for the gdal libs and command line utilities -- it
does not include th python bindings.
So you'll need to:
1) do: "easy install GDAL" -- which may find the binaries for you.
2) find a Windows installer for the binaries
3) download the source and do "python setup.py build", "python setup.py
install", but that will require that you have the right compiler set up.
> *Question 1*: Are there any problems in using GDAL 1.6 with Python 2.6
> on a win-xp?
I don't think there are any problems -- but it does look like there are
no easy-to-install binaries.
There are other binaries of GDAL around -- but I don't if any of them
have python bindings build in. FWTools and OSGeo4W do, but I don't know
if they are compatible with the ESRI-supplied python.
The state of binaries for Windows is not good -- but I'm not offering to
build them, so what can you do? If there is someone that does want to
supply easy-to-install Windows binaries for Python folks, but isn't sure
what they should do, I'd be glad to provide input on that, but I don't
work primarily on Windows, and compiling stuff there has always been a
pain for me.
> Looking into ...\gdalwin32-1.6\bin\ in find no *.py files (nor *.pyc)
>
> I would have expected some files with python extensions.
right -- that installer does not include the python bindings.
> What file exactly is the import statement supposed to find,
> that will enable it to include osgeo functionality?
You are looking for the right things -- properly installed, there will
be a "osgeo" package on your PYTHONPATH, probably in "site-packages"
Good luck, sorry I'm not more help.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
More information about the gdal-dev
mailing list