[gdal-dev] Python error in me or in gisinternals.com packages?

Rahkonen Jukka (MML) jukka.rahkonen at maanmittauslaitos.fi
Tue Oct 26 09:15:51 PDT 2021


Hi,

I can use GDAL Python bindings from OSGeo4W installation but folks in gis.stackexchange have problems with the gistinternals.com binaries so I had a try too. I installed

  *   python-3.7.9-amd64
  *   gdal-303-1928-x64-core MIS installer from gisinternals
  *   GDAL-3.3.2.win-amd64-py3.7 MSI installer from gisinternals

Now I have all from above and I have adjusted paths a bit and I can get this far:

  *   Python 3.7.9 starts
  *   I can load osr with "from osgeo import osr"
But if I try "from osgeo import ogr" I get:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:/Program Files\Python37\lib\site-packages\osgeo\ogr.py", line 245, in <module>
    import osr
ModuleNotFoundError: No module named 'osr'

Same thing with "from osgeo import gdal" but this time the error in on line 1931 in gdal.py and missing module is 'ogr'.

Do the errors mean that the Python stuff is using deprecated "import osr" and "import ogr" while they should have it as "import osgeo.osr" and "import osgeo.ogr" as they seem to stand in the working OSGeo4W installation? I do not have rights to edit the files, and they have also this warning in the beginning:
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.2
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.

-Jukka Rahkonen-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20211026/f0b30260/attachment.html>


More information about the gdal-dev mailing list