Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Cannot import GDAL

2,316 views
Skip to first unread message

Falter, Donald [USA]

unread,
Jan 11, 2017, 12:34:52 PM1/11/17
to
I am new to Python and I am trying to utilize GDAL. I installed Python 3.6. The version I get when I activate IDLE is: MSC v.1900 32 bit (Intel)] on win32. In downloading the GDAL bindings the latest version I can find is release-1800-gdal-2-1-2-mapserver-7-0-2 so I installed the following: gdal-201-1800-core.msi and GDAL-2.1.2.win32-py3.4.msi.

I added C:\Program Files\GDAL to my path and added the system variables GDAL_DATA = C:\Program Files\GDAL\gdal-data and\
GDAL_DRIVER_PATH = C:\Program Files\GDAL\gdalplugins

When I open IDLE and type the following: from osgeo import gdal I get the following error

>>> from osgeo import gdal
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
from osgeo import gdal
ModuleNotFoundError: No module named 'osgeo'
>>>

I have been all over the internet looking for answer but have found none that work. Some real help here would be appreciated.

Thanks,
Don

Irmen de Jong

unread,
Jan 11, 2017, 4:36:27 PM1/11/17
to
On 11-1-2017 18:31, Falter, Donald [USA] wrote:
> I am new to Python and I am trying to utilize GDAL. I installed Python 3.6.
> I installed the following: gdal-201-1800-core.msi and GDAL-2.1.2.win32-py3.4.msi.

Those don't match. You'll have to use a MSI built for py3.6, one thinks.

Either install and use Python 3.4 with this (rather than 3.6) or find the approprite
installer for python 3.6. It seems that you can get one here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal


Irmen

Fabien

unread,
Jan 11, 2017, 4:59:41 PM1/11/17
to
On 01/11/2017 06:31 PM, Falter, Donald [USA] wrote:
> I am new to Python and I am trying to utilize GDAL

GDAL is notoriously difficult to install :-(

I would strongly recommend to use conda
(http://conda.pydata.org/miniconda.html) for managing your packages and
environments, and then use the conda-forge channel
(https://conda-forge.github.io/) to install gdal:

conda install -c conda-forge gdal

Good luck!

Fabien

Fabien

unread,
Jan 11, 2017, 5:06:15 PM1/11/17
to
On 01/11/2017 10:59 PM, Fabien wrote:
> I would strongly recommend to use conda
> (http://conda.pydata.org/miniconda.html) for managing your packages and
> environments, and then use the conda-forge channel
> (https://conda-forge.github.io/) to install gdal:
>
> conda install -c conda-forge gdal


I forgot to mention that since py3.6 is quite recent, most packages
still don't have binaries ready for it. Staying with py3.5 is a better
idea for now.


Terry Reedy

unread,
Jan 11, 2017, 9:00:16 PM1/11/17
to
http://www.lfd.uci.edu/~gohlke/pythonlibs/
has 32 and 64 bit 3.6 binaries for over 200 packages, including GDAL 2.1.2.


--
Terry Jan Reedy

Terry Reedy

unread,
Jan 11, 2017, 9:07:01 PM1/11/17
to
On 1/11/2017 12:31 PM, Falter, Donald [USA] wrote:
> I am new to Python and I am trying to utilize GDAL. I installed Python 3.6. The version I get when I activate IDLE is: MSC v.1900 32 bit (Intel)] on win32. In downloading the GDAL bindings the latest version I can find is release-1800-gdal-2-1-2-mapserver-7-0-2 so I installed the following: gdal-201-1800-core.msi and GDAL-2.1.2.win32-py3.4.msi.
>
> I added C:\Program Files\GDAL to my path and added the system variables GDAL_DATA = C:\Program Files\GDAL\gdal-data and\
> GDAL_DRIVER_PATH = C:\Program Files\GDAL\gdalplugins
>
> When I open IDLE and type the following: from osgeo import gdal I get the following error

IDLE does not normally cause imports to fail (though it often get
blamed), but one can check by running, in this case, 3.6, from the
Windows console (ie, Command Prompt) and trying the same import statement.

>>>> from osgeo import gdal
> Traceback (most recent call last):
> File "<pyshell#0>", line 1, in <module>
> from osgeo import gdal
> ModuleNotFoundError: No module named 'osgeo'

Does C:\Program Files\GDAL contain a package 'osgeo' containing a module
'gdal'?

I am not sure if the version mismatch pointed out by others would cause
that particular error. If replacing the 3.4 package with a 3.6 package
fixes your problem completely, please let us know.

--
Terry Jan Reedy

0 new messages