I've been trying to install GDAL on Python 3.6.5 (64-bit) on Windows for the past hour, and nothing works.
I've visited some questions on SO, watched a video on YT, but none of them applies to my situation (which there's nothing special about it).
Can someone provide a step-by-step solution, preferably a tested one, so I can figure out what exactly I'm doing wrong?
I'm willing provide any OS setting info/screenshot if necessary.
Update: I'm trying to install GDAL to convert TIF (16-bit) files to JPG or PNG. Although I managed to install GDAL with the second method (at second try), I could not use gdal_translate
. So not every GDAL lib/version works for me.
First method:
GDAL 2.3.0 (suggested here)
- Dependencies:
- libgdal (2.3.0 or greater) and header files (gdal-devel) (where/how do I get this?)
- numpy (1.0.0 or greater) and header files (numpy-devel)
Requires "GDAL Windows Binaries". A Google search led me to this: DownloadingGdalBinaries – GDAL
- Tried GISInternals -> Releases -> release-1911-x64-gdal-2-3-0-mapserver-7-0-7
- Downloaded
"gdal-203-1911-x64-core.msi"
and"GDAL-2.3.0.win-amd64-py3.4.msi"
. (The latest release is for python 3.4?) - Installed
"gdal-203-1911-x64-core.msi"
to"C:\Program Files\GDAL"
. In README, it says
Add the installation directory bin folder to your system PATH...
C:\gdalwin32-1.7\bin
There is no
"bin"
folder in"C:\Program Files\GDAL"
. Folders in GDAL dir:"csharp"
,"gdal-data"
,"gdalplugins"
,"license"
,"projlib"
. So ...?I'm not even going to finish this because it seems outdated (I've emailed it's author about the description, so I hope it gets fixed). I followed the other steps, but it didn't work, obviously. Feel free to try it out.
- Dependencies:
Second method:
Gohlke Pythonlibs (suggested here)
- Downloaded
"GDAL-2.2.4-cp36-cp36m-win_amd64.whl"
At the top of the page, it says (I probably missed this in the first try)
Many binaries depend on numpy-1.14+mkl and ...
So I've downloaded
"numpy-1.14.4+mkl-cp36-cp36m-win_amd64.whl"
(it's in the same page)Installed them:
pip install numpy-1.14.4+mkl-cp36-cp36m-win_amd64.whl
pip install GDAL-2.2.4-cp36-cp36m-win_amd64.whl
and it worked (though I'm getting missing dll (ogr_FileGDB) error when using
gdal_translate
, so not using this)
- Downloaded
I'll be updating this with the methods I've tried.
The prebuild GDAL version from conda-forge works great on windows 64 bit python 3.6.5
You can install Anaconda (or Miniconda)
After installing Anaconda, I usually use the Anaconda prompt instead of the regular windows command prompt.
(Optional) If you would like to isolate this in a specific environment
I would recomend using environments with anaconda so create some environment like this
conda create --name gdal_env python=3.6.5
activate gdal_env
Environments are not required, so you can skip this step and continue to installing gdal.
Install gdal
conda install -c conda-forge gdal
I have found conda-forge to be the (by far) easiest way to install GDAL on windows. If for some reason you are required to use another python distribution, i have found the prebuild binaries from here to work fine too https://www.lfd.uci.edu/~gohlke/pythonlibs/ if you follow this guide