Skip to content

Installation

The geospatial-ml package has many dependencies, such as GeoPandas and localtileserver. These optional dependencies can sometimes be a challenge to install, especially on Windows. Therefore, we advise you to closely follow the recommendations below to avoid installation problems.

Installing with Anaconda/Miniconda

To install geospatial-ml and all its dependencies, we recommend you use the conda package manager. This can be obtained by installing the Anaconda Distribution (a free Python distribution for data science), or through Miniconda (minimal distribution only containing Python and the conda package manager). See also the installation docs for more information on how to install Anaconda or Miniconda locally.

Using the conda-forge channel

Geospatial-ml is available on the conda-forge channel, a community effort that provides conda packages for a wide range of software.

1
conda install -c conda-forge geospatial-ml

Creating a new conda environment

Creating a new environment is not strictly necessary, but given that some geospatial-ml dependencies might have a version conflict with other geospatial-ml packages in an existing conda environment, it is a good practice to install geospatial-ml and its dependencies in a clean environment starting fresh.

The following commands create a new conda environment with the name geo and install geospatial-ml and its dependencies (e.g., GeoPandas, localtileserver) in it:

1
2
3
4
conda create -n geo python=3.9
conda activate geo
conda install geopandas
conda install geospatial-ml -c conda-forge

Important note: If you are using Windows, we advise you to closely follow the installation instructions above to install GeoPandas from the default conda channel (conda install geopandas) rather than from the conda-forge channel. This can avoid a potential spatialindex_c-64.dll error when using GeoPandas (source). If you are using Linux or macOS, it is okay to install all geospatial-ml dependencies from the conda-forge channel with the following command:

1
conda install -c conda-forge geospatial-ml

Using Mamba

When installing packages using the conda package manager, sometimes it can take a while for conda to resolve dependencies. If it takes too long or fails to resolve dependencies, you can try using the Mamba package manager to install geospatial-ml and its dependencies. Mamba is a fast, robust, and cross-platform package manager. It runs on Windows, macOS, and Linux, and is fully compatible with conda packages and supports most of conda’s commands. Once Mamba is installed in a conda environment, you can then simply replace any conda command with mamba. For example, to install geospatial-ml and its dependencies with Mamba, you can use the following commands:

1
2
3
4
5
conda create -n geo python=3.9
conda activate geo
conda install -c conda-forge mamba
mamba install geopandas
mamba install -c conda-forge geospatial-ml

Installing with pip

geospatial-ml is also available on PyPI. It can be installed with pip using the following command:

1
pip install geospatial-ml

All optional dependencies of geospatial-ml are listed in requirements_dev.txt.

Installing from source

You may install the latest development version by cloning the GitHub repository with Git and using pip to install from the local directory:

1
2
3
git clone https://github.com/giswqs/geospatial-ml.git
cd geospatial-ml
pip install .

It is also possible to install the latest development version directly from the GitHub repository with:

1
pip install git+https://github.com/giswqs/geospatial-ml.git

Upgrading geospatial-ml

If you have installed geospatial-ml before and want to upgrade to the latest version, you can run the following command in your terminal:

1
pip install -U geospatial-ml

If you use conda, you can update geospatial-ml to the latest version by running the following command in your terminal:

1
conda update -c conda-forge geospatial-ml

Last update: 2023-04-23