Here are steps to install GDAL in Anaconda with python bindings.
- Download and Install Anaconda (or Miniconda for minimal setup)
- For Windows a shortcut to anaconda prompt will be created in the start menu which should open command prompt with conda activated.
- For Linux/Mac you will be asked remove the automatic initialization, if you choose
yes
, you will need to manually runconda init <shell>
.- Note: After initialization, conda will automatically activate the
base
environment by default everytime you open the terminal. If you don't prefer this configuration, runconda config --set auto_activate_base false
- Note: After initialization, conda will automatically activate the
- (Optional. You can skip this step if you want to only use
base
environment) Create a Conda environment with python.
conda create -n geospatial python=3.11
To list environments
conda env list
To activate an environment
conda activate geospatial
- Install GDAL
conda install -c conda-forge gdal
- Test your installation
gdalinfo --version
Should output something like this
GDAL 3.4.1, released 2021/12/27
To test python bindings:
from osgeo import gdal
print(gdal.__version__)
update (2025-05-20):
conda init
3.9
to3.11
. Tried3.13
but getting warning messages when runninggdal2tiles.py