Contents
- How to Install Conda from Linux Terminal
- How to Set Up a Conda Environment
- GDAL For Windows (outside conda environment)
- GDAL For Windows (inside conda environment)
- GDAL for Linux (inside conda environment)
- Rasterio (inside conda environment)
To install conda from linux terminal, run the following highlighted commands separately:
wget https://repo.anaconda.com/miniconda/Miniconda3-py39_4.12.0-Linux-x86_64.sh
(This one is miniconda for 64-bit OS but you can also pick the conda installer of your choice in this link.)bash Miniconda3-py39_4.12.0-Linux-x86_64.sh
A virtual environment like conda helps us to create isolated spaces to keep the versions of packages of a specific project. To create a conda environment use the command:
conda create --name your_conda_env_name python=insert_version
For linux, to prepare bash environment for use of command conda activate
anywhere, use the following command:
conda init bash
To activate the created conda environment use
conda activate your_conda_env_name
To install a package a package, use any of the following command:
conda install package_name
(From official Anaconda distribution)conda install --channel=conda-forge package_name
(From conda-forge channel often contains the latest version of a package)pip install package_name
(From PyPI, a package repository of open-source Python libraries. To make use of pip commands inside conda useconda install pip
)
conda deactivate
STEP 1: Go to this Link and select the package suited for your architecture. Select the msi installer of GDAL according to the version of python in your environment. Also, choose the insaller with description
Installer for the GDAL python bindings (requires to install the GDAL core)
.STEP 2: Install GDAL through the downloaded msi installer.
STEP 3: Check the version of the installed GDAL using the command gdalinfo --version
. Remember the version.
STEP 4: Go to command prompt and run the following seperately:
setx PATH "%PATH%;C:\Program Files (x86)\GDAL"
setx PATH "%GDAL_DATA%;C:\Program Files (x86)\GDAL\gdal-data"
setx PATH "%GDAL_DRIVER_PATH%;C:\Program Files (x86)\GDAL\gdalplugins"
setx PATH "%GDAL_VERSION%;insert_gdal_version_here"
(x86)
. Don't forget to remove the space before (x86).
STEP 1: Run the command
conda install -c conda-forge gdal
STEP 2: Check the version of the installed GDAL using the command gdalinfo --version
. Remember the version.
STEP 3: Go to command prompt and run the following seperately:
setx PATH "%PATH%;C:\Program Files (x86)\GDAL"
setx PATH "%GDAL_DATA%;C:\Program Files (x86)\GDAL\gdal-data"
setx PATH "%GDAL_DRIVER_PATH%;C:\Program Files (x86)\GDAL\gdalplugins"
setx PATH "%GDAL_VERSION%;insert_gdal_version_here"
(x86)
. Don't forget to remove the space before (x86).
To install gdal, use any of the following commands:
conda install -c conda-forge gdal
orpip install GDAL
STEP 1: Install GDAL using guide above.
STEP 2: Run the following command individually:
conda install -c conda-forge fiona
conda install -c conda-forge pyproj
conda install -c conda-forge shapely
conda install -c conda-forge rasterio