Installation Guide - GLOBIO4/GlobioModelPublic GitHub Wiki

Installing GLOBIO 4.1 environment

Warning

The installation instructions on this page are for a previous version of GLOBIO (v4.1). For installing the latest version of GLOBIO, see the root README.md. This wiki page is kept available for those aiming to work with the v4.1 version of GLOBIO.

This page describes how to install the software needed to run GLOBIO 4.1 on Windows 10 Pro and Windows 2016 (not tested).

The GLOBIO 4.1 framework and model are programmed in Python (version 3.9). For performing specific geographical calculations and data analysis several Python libraries are used. These include:

  • Numpy (1.19.4)
    • library for very fast raster calculations
  • SciPy (1.5.3)
    • library with additional scientific (raster) algorithms
  • Pandas (1.1.4)
    • library for data analysis
  • GDAL/OGR (3.1.4)
    • library for accessing vector and raster data, and geospatial algorithms
  • Shapely (1.7.1)
    • library for dealing with vector data
  • Geographiclib (1.50)
    • library for calculating geodetic distances and areas
  • NetCDF (1.5.5)
    • library for reading and writing NetCDF files

In addition GRASS GIS (version 7.8) is used for raster algorithms which are not available in the Python libraries.

Furthermore TauDEM (version 5.3.8) is used for extracting and analyzing hydrologic information from topography as represented by a DEM.

To manage Python 3 and the various libraries and apps Anaconda3 is used. Anaconda3 is a distribution of the Python programming language for scientific computing that uses Conda to simplify package management and deployment. It can create virtual environments which are isolated, working copies of Python that maintains specific versions of libraries or Python itself without affecting other Python projects on the same machine.

All software used to realize GLOBIO 4 is free available and open source software.

Text style convention

This installation guide uses the following text style convention:

  <plain text>

  <commandprompt commands, or screen input>
  <command responses>

Install Anaconda3

To get Anaconda3 select the preferred version and download the setup file from https://www.anaconda.com.

Run the setup file, for instance Anaconda3-2020.07-Windows-x86_64.exe.

During installation select or type:

All Users
C:\Anaconda3
Add Anaconda3 to the system PATH environment variable       ON
Register Anaconda3 as the system Python 3.8                 ON

Add the conda path to the Windows PATH

NOTE: This should be done automatically by your Anaconda installer if you check the "Add Anaconda3 to the system PATH environment variable" box. If you did not, this is how to do it (else skip to the next section):

For running the Conda command the path to the Conda execuable must be added to the Windows system path. Use an existing or open a new "Command Prompt". Setting the PATH for the current user only, type:

setx PATH %PATH%;C:\Anaconda3\condabin

Or setting the PATH for all users, type:

setx PATH %PATH%;C:\Anaconda3\condabin /m

As an alternative, setting the Windows system PATH can also be done interactively. In the File Explorer select "This PC" and in the contextmenu (right mouse click) choose "Properties". Click "Advanced system settings" and select the "Advanced Tab". Click "Environment Variables" and select in the user or system variables list the variable "Path" and click "Edit...".

Click "New" and type:

C:\Anaconda3\condabin

Remark: before this setting is active you must close the existing "Command Prompt" window(s) and open a new one!

Update Conda (optional)

To update Conda with the latest version open a command prompt (e.g. the Anaconda Prompt) and type:

conda update -n base -c defaults conda

Create the virtualenv globio41

A virtual environment is a named, isolated, working copy of Python that maintains its own files, directories, and paths so that you can work with specific versions of libraries or Python itself without affecting other Python projects on the same machine. For GLOBIO 4.1 we create its own virtualenv with the name globio41.

Use an existing or open a new "Command Prompt" and type:

conda create -n globio41 python=3.9

Proceed (\[y\]/n)? y

Activate the virtualenv globio41

Use the command prompt and type:

conda activate globio41

Install Python libs

Anaconda3 comes with many Python libraries installed by default. To run GLOBIO additional libraries need to be installed.

Use the "Command Prompt" and type (make sure that the globio41 virtualenv is activated):

common python libs

conda install -c conda-forge matplotlib pandas psutil pylint rtree

conda install -c conda-forge scikit-image scikit-learn

gdal

conda install -c conda-forge gdal

geographiclib

conda install -c conda-forge geographiclib

shapely

conda install -c conda-forge shapely

netcdf4

conda install -c conda-forge netcdf4

Anaconda may take a long time to find a valid combination of the above packages. The intention is to add an exported environment yaml to the public GLOBIO model to make the installation of the conda environment easier.

Install TauDEM (optional)

For running some GLOBIO Aquatic modules TauDEM must be installed.

TauDEM (Terrain Analysis Using Digital Elevation Models) is a suite of Digital Elevation Model (DEM) tools for the extraction and analysis of hydrologic information from topography as represented by a DEM (http://hydrology.usu.edu/taudem/taudem5).

Installing TauDEM on Windows

Installing TauDEM on Windows is straightforward. Use the command prompt and type (make sure that the globio41 virtualenv is activated):

conda install -c conda-forge taudem

Installing TauDEM on Ubuntu 16.4

For Linux machines TauDEM must be compiled from source.

TauDEM has the following dependencies:

  • GDAL 2.1 development files.
  • Message Passing Interface (MPI).

Installation

To get the TauDEM source code download it from the GitHu repository: https://github.com/dtarb/TauDEM. Use the download button and download the code as a zip file.

Copy the zipfile to the directory /usr/local/src on the server.

Prepare the installation and get information about updated versions of packages:

sudo apt-get update

Add build essentials:

sudo apt-get install build-essential checkinstall

Unzip the source code zipfile:

cd /usr/local/src

unzip TauDEM-Develop.zip

Rename the directory:

sudo mv TauDEM-Develop taudem

Install MPI:

sudo apt-get install libcr-dev mpich

(Optional) If not already installed install GDAL 2.1:

sudo add-apt-repository ppa:ubuntugis/ppa

sudo apt-get update

sudo apt-get install gdal-bin=2.1.3+dfsg-1\~xenial2

sudo apt-get install libgdal-dev=2.1.3+dfsg-1\~xenial2

Create bin directory and set permissions:

sudo mkdir -p /usr/local/src/taudem/bin

sudo chmod -R a+rwx /usr/local/src/taudem

Compile the source code:

cd /usr/local/src/taudem/src

make

When successful the binaries are located in /usr/local/src/taudem/src.

Tip - Check the installation

Do a simple test and run the aread8 tool:

cd /usr/local/src/taudem/bin

mpiexec -np 3 ./aread8

When successful some usage information should be shown.

Using in GLOBIO

For using TauDEM in GLOBIO add the following lines to the globio4.bat or run.sh scripts which are located in the main GLOBIO directory.

### Set TAUDEM var.
export TAUDEMPATH=/usr/local/src/taudem/bin

Install GRASS

GRASS GIS for Windows is not available as an Anaconda3 package so this program is installed outside the globio41 virtualenv.

To get GRASS GIS download the standalone installer from https://grass.osgeo.org/download/windows.

Run the setup file, for instance WinGRASS-7.8.4-1-Setup-x86_64.exe.

During installation select or type:

Install Dir
    C:\Program Files\GRASS GIS 7.8
Important MS Dlls                           ON
Download msvc\*                             YES

Tip - Check the installed packages and versions

To check installed Anaconda packages use the command prompt and type:

conda activate globio41

conda list
# packages in environment at C:\Anaconda3\envs\globio41:
#
# Name Version Build Channel
astroid 2.4.2 py39hde42818_1 conda-forge
blosc 1.20.1 ha925a31_0 conda-forge
boost-cpp 1.74.0 hd4e6614_0 conda-forgebrotli 1.0.9 ha925a31_3 conda-forge
...

Setting paths in script file globio.bat or run.sh

After successfully installing all the required packages and GLOBIO source files you should adapt the paths in the globio4.bat or run.sh script file.

Edit paths and settings in globio4.bat or run.sh script file as follows:

@REM ### Activate globio environment.
call <Anaconda3_directory>\condabin\conda activate globio41

@REM ### Set GLOBIO4 env. var.
set GLOBIO4=<GLOBIO4_base_directory>

@REM ### Set PYTHON env. vars.
set PYTHONEXEPATH=<Anaconda3_directory>\envs\globio41
set PYTHONEXE=%PYTHONEXEPATH%\python.exe

@REM ### Set GRASS env. vars.
set GRASS=<GRASS_directory>\grass78
set GISBASE=%GRASS%

@REM ### Set TauDEM path.
set TAUDEMPATH=%PYTHONEXEPATH%\Library\bin\

@REM ### Set PYTHONPATH env. var.
set PYTHONPATH=%GLOBIO4%;%GRASS%\etc\python

@REM ### Run globio Python script.
%PYTHONEXE% %GLOBIO4%\GlobioModel\Core\Globio4.py %1 %2
⚠️ **GitHub.com Fallback** ⚠️