Having trouble installing GDAL for python
On Windows the easiest way to install GDAL is to use pre-built binaries unless you have special needs that require building GDAL from source. Apart from conda
, as mentioned by @Mike Müller, there are three common sources for GDAL Windows binaries (with Python bindings):
- Gohlke Pythonlibs
- GISinternals
- OSGEO4W
To install GDAL on windows, you need to follow the below-mentioned step: -
- You need to install GDAL wheel file using the link https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal . After visiting this link, download this file named "GDAL‑3.0.4‑cp37‑cp37m‑win32.whl" since it worked for me and then use the command "pip install c:\Users........\GDAL‑3.0.4‑cp37‑cp37m‑win32.whl" to successfully install GDAL which is the requirement of Geopandas.
NOTE: If the above-mentioned wheel file doesn't work for you, then try using alternate wheel files.
Probably the easiest way to install such kind of libraries is conda
. Get and install Miniconda as user, not root. Now, create a new environment and install gdal
into it:
conda create -n gdal_test python=3.5
activate gdal_test
conda install gdal
You need to stay inside this shell window. i.e. th prompt should like this (gdal_test)
. Start Python:
python
>>> import gdal
Note: On Linux and Mac OS X use source activate gdal_test
.
To find out what versions of gdal
are available, type:
conda search gdal
An output like this:
gdal
....
2.0.0 np110py34_0 defaults
means gdal 2.0.0
is available for Python 3.4 and needs NumPy 1.10.