/conda_envs

conda environment setup in Linux / macOS for InSAR data processing

Primary LanguageShell

conda_envs

Setup InSAR data processing codes on Linux / macOS using conda environments.

1. Install conda

mkdir -p ~/tools; cd ~/tools
# for macOS, use Mambaforge-MacOSX-x86_64.sh, and optionally use `curl -L -O https://...` syntax to download
wget https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh
bash Mambaforge-Linux-x86_64.sh -b -p ~/tools/mambaforge
~/tools/mambaforge/bin/mamba init bash

Close and restart the shell for changes to take effect. Then install the following utilities:

mamba install wget git tree --yes

2. Install ISCE-2 and MintPy

Option 1: Install isce2 (conda version) and mintpy (conda version)

Both isce2 and mintpy are available on the conda-forge channel and can be install via mamba as:

mamba install isce2 mintpy

Add below in your source file, e.g. ~/.bash_profile for bash users or ~/.cshrc for csh/tcsh users:

export PATH=${PATH}:${ISCE_HOME}/bin:${ISCE_HOME}/applications  # ISCE_HOME/STACK are set by conda

Option 2: Install isce2 (conda version) and mintpy (development version)

a. Download source code
cd ~/tools
mkdir isce2; cd isce2
mkdir build install src; cd src
git clone https://github.com/isce-framework/isce2.git

cd ~/tools
git clone https://github.com/insarlab/MintPy.git
git clone https://github.com/insarlab/PyAPS.git
git clone https://github.com/insarlab/PySolid.git
git clone https://github.com/yunjunz/conda_envs.git
git clone https://gitlab.com/earthscope/public/sar/ssara_client.git utils/SSARA
b. Install to insar environment
# create new environment
conda create --name insar --yes
conda activate insar

# install dependenciues and isce2
cd ~/tools
mamba install --file conda_envs/insar/requirements.txt --file MintPy/requirements.txt isce2">=2.6.3" --yes

# install MintPy in editable mode
python -m pip install -e MintPy
# [for developers] overwrite PyAPS and PySolid installation from conda to the editable mode
python -m pip install -e PyAPS
export SETUPTOOLS_ENABLE_FEATURES="legacy-editable"
python -m pip install -e PySolid

# install dependencies not available from conda
ln -s ${CONDA_PREFIX}/bin/cython ${CONDA_PREFIX}/bin/cython3
python -m pip install ipynb     # import functions from *.ipynb files
python -m pip install jupyter_nbextensions_configurator
c. Setup

Create an alias load_insar in ~/.bash_profile file for easy activation, e.g.:

alias load_insar='conda activate insar; source ~/tools/conda_envs/insar/config.rc'
d. Test the installation

Run the following to test the installation:

load_insar               # warm up conda environment
topsApp.py -h            # test ISCE-2
smallbaselineApp.py -h   # test MintPy

Useful resources