Can anyone explain how to install GDAL/OGR with Python on Windows?

I have Windows Vista and I have tried following the information on the website and it does not seem to bind the *.exe files for me.

Can someone describe the process, including links to the files/folders I will need?

I have now tried to run the GDAL setup with minGW, but this has also failed:


  • Try this guide that I wrote some time back: aayushpanda.medium.com/installing-gdal-with-python-binders-ce41c641808f#5db4-d553bc15949f Apr 8, 2021 at 2:48

14 Answers 14


Unless you have good reasons not to, I'd definitely recommend starting with the OSGeo4W installer, which can install multiple different versions of GDAL and their relevant Python bindings. It works great and dramatically simplifies the Windows deployment story. Specifically, you'll want to install pkg-gdal-python, which is within 'Libs' in the installer tree.

  • 9
    So I used the OSGeo4W installer to install gdal and then tried their little command line interface, but was still unable in python to do the following: import gdal
    – GuidoS
    Sep 30, 2010 at 16:21
  • 7
    OSGEO4W installs it's own Python instance under the OSGEO4W root. To use the Python that includes gdal and all of the other OSGEO modules, open the OSGEO4W shell start>program files>osgeo4w. Launch Python or run a Python script from there.
    – DavidF
    Sep 30, 2010 at 16:51
  • 11
    Try from osgeo import gdal
    – DavidF
    Sep 30, 2010 at 19:41
  • 3
    @scw please consider rolling up the examples from the comments into your answer. It will make it easier to piece the relevant information together into a cohesive whole (in part because of being able to preserve code formatting). Vote up the comments you use as means of crediting and acknowledging the source. Oct 12, 2010 at 17:40
  • 7
    Is there a way to use "from osgeo import gdal" from my main python shell instead of using OSGEO's shell? Oct 20, 2015 at 12:57

You can download GDAL wheel package from Christoph Gohlke's Unofficial Windows Binaries for Python Extension Packages.

It can be installed from cmd.exe using something like:

c:\Python27\Scripts\pip.exe install GDAL-X.Y.Z-cp27-none-win_XYZ.whl

(You should install NumPy from the same place using a similar command)

While the package is not built by OSGeo or GDAL developers, it is a high quality distribution with support for the latest versions of GDAL compiled for 32-bit and 64-bit versions of Python. No external libraries need to be added or managed!

Update it even sets the GDAL_DATA environment variable, if it is not set, and includes a PostgreSQL driver to read data from PostGIS.

  • 6
    +1 I've found that page an invaluable source of Python distributions for 64-bit Windows May 17, 2011 at 19:46
  • 1
    I'm having difficulty with this installer working as it is failing to detect my python installations. I have python26 and python27 installed in C:/Python2X but it can't find it.... nevermind! Choose 64 bit instead of 32....
    – djq
    Dec 27, 2011 at 15:11
  • This worked for me much easier than the accepted answer since I don't want another install of Python and Numpy. Jan 14, 2014 at 20:28
  • These lines are now included with installation.
    – Barbarossa
    Mar 14, 2016 at 16:45
  • 1
    2020, Wheel is incompatible with this platform. Python 3.6, wheels for amd64 (I don't have AMD but many people mark 64 bit as amd64) and the straight w32. Windows 7 not 10. VS2019 and VS2017 with MS' Python support built in. Still stuck.
    – Bob Denny
    Aug 9, 2020 at 17:49

I find OSGEO4W a poor solution because it creates a whole parallel universe, almost like a virtual machine. I was able to install GDAL and use it in python following the steps outlined here (this is the link provided by @sys49152).

It sends you to gisinternals.com. Take the link to "stable releases" to get to: http://www.gisinternals.com/release.php

Now you have to choose between 32 and 64 bits and different Microsoft Visual C++ compiler versions. Note that this has to match your python version, not your OS. In my case I have a 64 bit windows, but a 32 bit python 2.7 (that shipped with ArcGIS).

To see what you have you can run python on the command line and a message like this:

Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

So I need to use "release-1500"

I selected: MSVC 2013/win32 release-1500-gdal-1-11-3-mapserver-6-4-2

(the build version numbers will change over time)

I first downloaded and installed the "Generic installer for the GDAL core components": gdal-111-1500-core.msi

And added the path and other variables as described here.

Add to path: C:\Program Files (x86)\GDAL Create environmental variables: GDAL_DATA = C:\Program Files (x86)\GDAL\gdal-data GDAL_DRIVER_PATH = C:\Program Files (x86)\GDAL\gdalplugins

Then, I downloaded and installed the python module for python 2.7 GDAL-1.11.3.win32-py2.7.msi

And after that, in python I was able to do

from osgeo import gdal
ds = gdal.Open('file.tif')


  • Nicely documented step-by-step. Thank you. Apr 5, 2016 at 3:56
  • Very good and useful answer still in 2022. After doing these in my Windows 10 computer, I also needed to install SQL Management Studio 2014 and Microsoft .Net Framework 3.5 SP1. One last edit was, in "osgeo" folder "gdal.py" file's 1966th line i changed "import osr" to "from osgeo import osr" and things finally started to work. Feb 16 at 20:48
  • Also check jcjaimes answer at bottom in this question: gis.stackexchange.com/questions/44958/… Mar 3 at 12:21

Another option is to install the Anaconda Python distribution which has packages for GDAL. If you are going to be doing a lot of work using GDAL with other Python packages (scipy, pandas, scikit-learn etc.,) this might be a better option than OSGeo4W. On the other hand if you want to use Python in combination with a number of open source remote sensing and GIS packages (GRASS, QGIS etc.,) OSGeo4W is probably the better option.

You can get the full Anaconda distribution from: https://www.continuum.io/downloads which contains a lot of Python packages aimed at 'data science' or a minimal installation from http://conda.pydata.org/miniconda.html

As part of the installation it will prompt you to add to the main path (so it is available from any terminal).

Once set up GDAL can be installed into a new environment using:

conda create -n gdal_env -c conda-forge gdal

Then activating it as show when the command finishes. Installing into a new environment is recommended to avoid conflicts with other packages and make sure the environmental variables required are set.

I've suggested installing from the conda-forge channel (https://conda-forge.github.io/) as they are very active in keeping their GDAL builds up to date and making sure they work against a lot of libraries.

Once installed packages can be updated from within the environment using:

conda update gdal
  • 1
    This is definitely the easiest method, especially if you plan on installing other complex Python packages (e.g. scikit-learn, numpy)
    – bgordon
    Jun 4, 2018 at 8:56
  • 1
    This is great! Especially nice b/c you can run it through the command line as well as through python.
    – mmann1123
    Sep 21, 2018 at 16:46
  • One can also install it by going to "Environments" and select the environment that one wants to use. Then search "gdal" in "All" of the packages Jan 19, 2019 at 15:20

Here is another tutorial which explains very simple and easy way of installing GDAL v1.8 with Python v2.7 on a Windows XP/7 system.



I know The OSGEO installer was mentioned, but as GuidoS said it doesn't work unless you're on the osgeow shell, which is fine and dandy if all you're doing is basic python. Chances are if you're not, you either have to reinstall the package and then have to run your app/plugin from that folder or have to compile all the dependencies for gdal and install it again.

What works for me is:

  • In PyDev/Eclipse (not my primary IDE), I add the list of libraries to the default python interpreter
  • Use the built in console to run the files
  • 3
    You can set o4w python as the system default python, e.g. make it available to everything, by adding it to the system registry. There is a python script for doing this on 32bit windows at trac.osgeo.org/osgeo4w/ticket/114 (64bit must be added by hand). Oct 12, 2010 at 17:31

Another current, very easy option for downloading the gdal binaries is at Christoph Gohlke’s site

Thanks to blog post at http://fuzzytolerance.info/code/postgis-raster-ftw/ for the link.


Its really not that difficult to do. I've compiled it many times before using Visual Studio without any issues. Just follow the directions here: link text.

It's pretty straightforward, just read through the well documented makefile.vc and set the appropriate directories, notably the Python one. Once it's built you should have a Python module built which you can then copy to your Python installation, which I've always done maually, but there is probably a more approriate method.


The two top answers by @SCW and @Mike Toews are great. The site listed by Mike is for unofficial binaries - which was very useful when 64 bit GDAL was not readily available (as per the time he wrote his reply), but it has been now for some time. I have added this alternative answer here as, although I have mentioned it many times, it still keep cropping up and this wiki may be a better place to put it.

If you want to install just the GDAL Binaries for Python on a windows machine I would get the installers from the excellent GIS Internals Site. This site is linked from the official GDAL/OGR Binaries page. This gives you access to GDAL through a normal Python install without any need for using the osgeow shell. The binaries here are regularly maintained and compiled against a variety of versions of Visual Studio (so choose depending on what runtimes you have installed).

  • It is no problem at all to have several MSVC runtimes installed on the same computer. If you need special drivers like ECW and MrSid, note that there are different opportunities compiled under the different MSVC plattforms. Just follow the information link and see the differences.
    – AndreJ
    Jul 28, 2015 at 8:05

Like the other contributors, I advice to choose OSGEO4W installer.

If for any reasons, you don't want or can't use it, see the Python packages documentation on gdal http://pypi.python.org/pypi/GDAL/

You will discover, for example, there are gdal binaries on OSGEO website


I use FWTools in Windows XP. It includes a Python installation with the GDAL libraries. After installation, just run your Python scripts from the FWTools Shell.

  • 1
    FWTools was a good tool at the time, but is has got no updates since then. I suggest to switch to gisinternlas which is still actively maintained.
    – AndreJ
    Jul 28, 2015 at 8:08

I just did it yesterday following this tutorial http://www.gis.usu.edu/~chrisg/python/2009/docs/gdal_win.pdf It worked fine to me.

  • 1
    Please summarize the main concept here, otherwise this answer might turn useless when the links break.
    – underdark
    Jul 27, 2015 at 21:51

I had much problem today, but now it is solved, and I put my recordings here,


basically, I refer to the accepted answer of this question


  • 1
    Please summarize the main concept here, otherwise this answer might turn useless when the links break.
    – underdark
    Jul 27, 2015 at 21:51

I normally install using pipwin command. It is straightforward and easy way to install the latest version of GDAL.

pip install pipwin
pipwin install gdal

If it throws the 404 error, you may need to refresh the pipwin and try again,

pipwin refresh
pipwin install gdal

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.