Unable to install Python and GDAL (DLL load failed)
Solution 1
To successfully load GDAL from python in Windows 7, I follow these steps, which should be quite generic:
- Install python of your choosing, I used v2.7.2 x64 downloaded from the official website
- Run python from command line to determine the compiler version used to build python (mine shows this message:
Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)] on win32
) - Download the corresponding SDK from this link: http://www.gisinternals.com/release.php. Select the correct package for your python (if using the above configuration, then
MSVC2008 x64 release
link should be selected). - From the subpage, download the following:
- GDAL core components
- Python bindings
- Install GDAL core components, add the installation dir to path, and add new environment variable 'GDAL_DATA' pointing to data subdirectory of GDAL installation.
- Install python bindings
- You should be profiting from them by now :)
Solution 2
The step by step procedure is great. But I had the same issue.
This was caused because my PATH
variable has other paths where a same named dll
was used. If you put the c:\program files\gdal
before the other paths in PATH
, it works fine!
Solution 3
After searching and making many steps from the above answers with no result, i finally got install to Win7 gdal by using the installer from Unofficial Windows Binaries for Python Extension Packages
Just scroll down the page and find GDAL section and get your version installer.
Solution 4
solution for python 3.4, v.1600, Windows 10
make sure what your python version is
python -v
Python 3.4.2 (v3.4.2:ab2c023a9432, Oct 6 2014, 22:15:05) [MSC v.1600 32 bit (Intel)] on win32
so here you see that it's v.1600 and 32 bit. Then go here
http://www.gisinternals.com/query.html?content=filelist&file=release-1600-gdal-mapserver.zip
and download:
- gdal-201-1600-core.msi
- GDAL-2.1.0.win32-py3.4.msi
- Install these msi files
a. then make sure you DON'T GET OSGEO4W installed anywhere (just remove the folder completely if you got it installed).
b. go and edit your environment vars and include in PATH: C:\Program Files (x86)\GDAL; (include in the beginning!)
c. restart your python / virtualenv and IDE.
You should get everything working at this point
there are also bindings for python 2.7, 3.3, 3.1, other releases http://www.gisinternals.com/development.php
Solution 5
I successfully installed gdal on 32 bit Windows from here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal. I solved the "side by side" DLL error by installing this Microsoft Visual C++ 2008 Service Pack 1 Redistributable Package MFC Security Update.
Related videos on Youtube

Mario Härtwig
Updated on July 28, 2020Comments
-
Mario Härtwig almost 3 years
I am trying to install GDAL and Python on my Windows 7 workstation.
- Python-version: 2.6.6
- Gdal 1.8
- (Visual Visual C++ Studio 2010 Express)
I followed the instructions at http://ucsb.pbworks.com/w/page/1936549/Using-GDAL-with-Python and added PYTHONPATH and the GDAL_DATA to my systems environment variables. Furthermore I modified my PATH variable by adding the GDAL binaries folder.
The GDAL Python bindings I downloaded from: http://vbkto.dyndns.org/sdk/PackageList.aspx?file=release-1600-gdal-1-8-mapserver-5-6.zip
"from osgeo import gdal" causes the following error-message:
Traceback (most recent call last): File "<pyshell#2>", line 1, in <module> from osgeo import gdal 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_import_helper _mod = imp.load_module('_gdal', fp, pathname, description) ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.
Thanks in advance, Martwig
-
Mario HärtwigI solved the problem by installing the MSVC2008-compiled versions of gdal and the gdal-python bindings from vbkto.dyndns.org/sdk. Furthermore I had to remove a backslash in my environment variables ("c:/Program Files/GDAL" instead of "c:/Program Files/GDAL/").
-
Sideshow Bob over 10 yearsThis worked for me too, on Windows XP, after following the instructions here gis.usu.edu/~chrisg/python/2009/docs/gdal_win.pdf
-
csparpa about 10 yearsWorked on win7x32 with Python 2.7 and GDAL 9.1 + Python bindings from gisinternals.com
-
Irene almost 9 yearsYes, it works like a charm! Basically, it is VERY IMPORTANT, to match the compiler version of Python, the Python binding and the GDAL Core package. In my case, I downloaded version 1600 of Python binding and GDAL core package because they were the latest at this moment (08/2014). However, the compiling version of my Python was 1500. Additionally, I confused architectures: My laptop is a 64 bits machine, HOWEVER, my Python version is 32 bits. So I had to find Python binding packages + GDAL core packages for Win 32 bits architecture AND compiling version 1500. Both things. Hope this helps! :-)
-
elrobis almost 8 years@iamgin makes a good point. Also, that I know of, there are at least three (maybe more?) environment variables that need attention:
PATH
(;C:\Program Files (x86)\GDAL
),GDAL_DATA
(C:\Program Files (x86)\GDAL\gdal-data
), andGDAL_DRIVER_PATH
(C:\Program Files (x86)\GDAL\gdalplugins
). These values may be different depending on your version of Windows and whether you changed any settings when you installed GDAL, so double-check that these disk addresses are valid before proceeding. -
Tom Bombadil almost 8 yearsThe
dyndns.org
link does not work anymore, the site has moved to gisinternals.com -
avee almost 8 yearsFixed the link in the answer
-
Valachio about 5 yearsHow do you know what release to choose? There is 1500, 1600, 1700 and so on. But nothing in the Python version indicate which release to choose.
-
avee about 5 yearsHave you checked your python build version by executing
python
from the command line? Read step no. 2. That said, I haven't been on Windows for quite some time, so things might have changed..