Installation

Installing from source

Setup GDAL

GDAL is required when building from source.

GDAL Installation Instructions

You can also download GDAL from:

Additionally, you can use conda with the conda-forge channel:

conda config --prepend channels conda-forge
conda config --set channel_priority strict
conda create -n yagdal_env libgdal cython
conda activate yagdal_env

Note

“… we recommend always installing your packages inside a new environment instead of the base environment from anaconda/miniconda. Using envs make it easier to debug problems with packages and ensure the stability of your root env.”

yagdal Build Environment Variables

GDAL_VERSION

This sets the version of GDAL when building yagdal. This enables installing yagdal when the GDAL executables are not present but the header files exist.

GDAL_DIR

This is the path to the base directory for GDAL. Examples of how to set the GDAL_DIR environment variable:

Windows:

set GDAL_DIR=C:\OSGeo4W\

Linux:

export GDAL_DIR=/usr/local
GDAL_LIBDIR

This is the path to the directory containing the GDAL libraries. If not set, it searches the lib and lib64 directories inside the GDAL directory.

GDAL_INCDIR

This is the path to the GDAL include directory. If not set, it assumes it is the includes directory inside the GDAL directory.

YAGDAL_WHEEL

This is a boolean value used when building a wheel.

YAGDAL_FULL_COVERAGE

Boolean that sets the compiler directive for cython to include the test coverage.

Setup yagdal

In the setup.py, the order for searching for GDAL is:

  1. The GDAL_DIR environment variable

  2. The gdalinfo executable in sys.prefix

  3. The gdalinfo executable on the PATH

For best results, set the GDAL_DIR environment variable to point to location of GDAL installation before running setup.py.

Install yagdal

Note

Cython or pip>=10.0.1 is required for the installation.

Note

You may need to run pip with administrative privileges (e.g. sudo pip) or perform a user only installation (e.g. pip install –user).

From GitHub with pip:
pip install git+https://github.com/yagdal/yagdal.git
From cloned GitHub repo for development:
pip install -e .