ISCE2 and Mintpy Installation in Linux
此博客记录在Linux系统中重新安装ISCE2和Mintpy环境的流程。
1. 系统信息
- Opreating System: Ubuntu 22.04
- Miniconda: 25.5.1
- Python: 3.1335
2. 安装ISCE2和Mintpy
ISCE is open source and on GitHub. There is also extensive documentation.
-
Install Miniconda
- create a new directory named “miniconda3” in your home directory.
- download the Linux Miniconda installation script for your chosen chip architecture and save the script as miniconda.sh in the miniconda3 directory.
- run the miniconda.sh installation script in silent mode using bash.
- remove the miniconda.sh installation script file after installation is complete.
1
2
3
4mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm ~/miniconda3/miniconda.shAfter installing, close and reopen your terminal application or refresh it by running the following command:
1
source ~/miniconda3/bin/activate
Then, initialize conda on all available shells by running the following command:
1
conda init --all
-
创建单独的
conda environment
1
2conda create -n isce2 python=3.13 # or 3.8 and above
conda activate isce2- 安装必要的
python
包
1
conda install -c conda-forge git scons cython gdal h5py libgdal pytest numpy fftw scipy pybind11 shapely opencv basemap
- to compile/install mdx, you will also need
openmotif
1
conda install -c conda-forge openmotif opencv
检查是否安装成功:
1
2
3
4
5
6
7# to check whether there is one
ldconfig -p | grep libXm
# if not present, install as follows (need root privilege)
# Ubuntu/Debian
sudo apt install libxm4
# Redhat CentOS
dnf install motif, motif-devel- You will need to make a symbolic link for
cython3
, (this is important, otherwise, some packages will be skipped)
1
2cd $CONDA_PREFIX/bin
ln -sf cython cython3 - 安装必要的
-
Install conda version isce2 and mintpy
- Download source codes
1
2
3
4
5
6
7
8
9
10
11
12
13
14cd ~/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
mkdir -p ~/tools/utils; cd ~/tools/utils
git clone https://gitlab.com/yunjunz/SSARA.git
git clone https://github.com/yunjunz/sardem.git- 新建一个
~/tools/isce_requirments.txt
文件
1
2
3
4
5
6
7
8
9
10
11
12
13python=3.8.6
cython
gdal
git
h5py
libgdal
pytest
numpy
fftw
scipy
basemap
scons
opencv- Install to
insar
environment
1
2
3# create new environment
conda create --name isce2 --file isce_requirements.txt
conda activate insar使用
conda
或mamba
安装mintpy
1
mamba install conda-forge::mintpy pysolid pyaps3 sardem
以下安装在国内失败,弃用
1
2
3
4
5
6
7
8
9
10# [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
python -m pip install -e utils/sardem- Setup
Create an alias
load_insar
in~/.bash_profile
file for easy activation, e.g.:1
alias load_insar='conda activate insar; source ~/tools/conda-envs/insar/config.rc'
-
在
~/tools/conda-envs/insar/config.rc
文件中添加如下内容:1
2
3
4
5
6
7##---------------------- Work Dirs ----------------##
export WORK_DIR=~/Documents/00_my_projects/01_isce_test
export ORBIT_PATH=${WORK_DIR}/orbits
export AUX_PATH=${WORK_DIR}/AUXFILE
export DEM_PATH=${WORK_DIR}/DEM
export SLC_PATH=${WORK_DIR}/SLC
export INSAR_WORK_DIR=${WORK_DIR}/stacks -
在
~/.netrc
文件中添加如下内容:1
machine urs.earthdata.nasa.gov login mengyuchi password 5212109Mengle
-
Test the installation
Run the following to test the installation:
1
2
3load_insar # warm up conda environment
topsApp.py -h # test ISCE-2
smallbaselineApp.py -h # test MintPy -
下载测试数据并测试ISCE与Mingpy
- 下载测试数据:
1
2
3load_insar
cd ~/Documents/00_my_projects/01_isce_project/01_isce_test剩余测试操作步骤详见
-
失败Install ISCE2: (此部分在我的linux环境中失败,放弃isce开发者环境的安装)
- Download isce2 for GitHub or prepare your own version
1
2
3
4
5# create a directory to save source files
mkdir -p ${HOME}/tools/src
cd $HOME/tools/src
# glone a copy from github
git clone https://github.com/isce-framework/isce2此命令将下载ISCE2的github版本到指定目标文件夹
/home/tools/src/isce2
- 在文件夹
$HOME/.isce
下配置SConfigISCE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16PRJ_SCONS_BUILD=$HOME/build/isce_build
PRJ_SCONS_INSTALL=$ISCE_HOME
LIBPATH=$CONDA_PREFIX/lib
CPPPATH=$CONDA_PREFIX/include $CONDA_PREFIX/include/python3.13/ $CONDA_PREFIX/lib/python3.13/site-packages/numpy/_core/include $CONDA_PREFIX/include/opencv4
FORTRAN=gfortran
CC=gcc
CXX=g++
FORTRANPATH=$CONDA_PREFIX/include
# note: if you use system-installed openmotif, change the settings below accordingly
MOTIFLIBPATH=$CONDA_PREFIX/lib
X11LIBPATH=$CONDA_PREFIX/lib
MOTIFINCPATH=$CONDA_PREFIX/include
X11INCPATH=$CONDA_PREFIX/include
RPATH=$CONDA_PREFIX/lib
ENABLE_CUDA = True
CUDA_TOOLKIT_PATH=/usr/local/cuda # use 'which nvcc' to verifySConfigISCE
文件中参数的解释:
PRJ_SCONS_BUILD
is a directory to save temporary compiled filesPRJ_SCONS_INSTALL
is where the isce2 will be installed. We use a $ISCE_HOME to be defined laterLIBPATH
is where to look for the shared libraries, such as gdal, fftwCPPPATH
is where to look for C/C++ head files (#include) for libraries. Use the following commands to find the proper path(s) if you use a different python version or system1
2
3
4# Python.h location
python3 -c "import sysconfig; print(sysconfig.get_path('include'))"
# numpy include
python3 -c "import numpy; print(numpy.get_include())"FORTRAN
,CC
,CXX
are theFortran/C/C++
compilers to be usedFORTRANPATH
,MOTIFLIBPATH
…X11INCPATH
are to set lib and include paths for motif and x11 libraries.- for Ubuntu 18.04, set
MOTIFLIBPATH1
andX11LIBPATH
to /usr/lib/x86_64-linux-gnu/
and setMOTIFINCPATH
andX11INCPATH
to/usr/include
. - for conda installed packages, set them as
$CONDA_PREFIX/lib
and$CONDA_PREFIX/include
.
ENABLE_CUDA = True/False
whether to include some GPU/CUDA accelerated modules. If enabled, please also specifyCUDA_TOOLKIT_PATH
to whereCUDA SDK
is installed. Some manual configuration might be needed.Some settings for environment variables before compile/install. You need to specify three environment variables:
CONDA_PREFIX
where Anaconda3 is installed
ISCE_HOME
where isce2 will be installed
SCONS_CONFIG_DIR
where theSConfigISCE
is located. if they are not set. Check by, e.g.,echo $CONDA_PREFIX
.for
bash
1
2export ISCE_HOME=$HOME/tools/isce
export SCONS_CONFIG_DIR=$HOME/.isce- Compile/install isce2
1
2cd $HOME/tools/src/isce2
scons installIf successful, you should obtain a compiled isce2 at
$ISCE_HOME
or$HOME/tools/isce
.- 安装中部分错误信息
sh: 1: gfortran: not found
: 原因应该是gfortran包未正确安装
1
sudo apt-get install gfortran
error: Xm/Xm.h: No such file or directory
1
sudo apt-get install libmotif-dev
Error: Type mismatch between actual argument at (1) and actual argument at (2) (COMPLEX(4)/REAL(4)).
是一个非常经典的
Fortran
编译器严格性问题,尤其在使用新版gfortran
编译 ISCE2 等较老的 Fortran 代码时。在$HOME/.isce
文件中,使用gedit SConfigISCE
添加下面一行:1
FORTRANFLAGS = '-fallow-argument-mismatch'
- 成功安装
ISCE2

-
配置ISCE2环境路径
- 可以在目录
/home/yuchi/Documents/00_my_projects/01_isce_project
下手动新建isce配置文件isce.rc
并在此目录下运行source isce.rc
.
1
2
3
4
5
6
7
8
9
10
11
12
13
14# isce2.rc
# 1. 设置 ISCE_HOME 环境变量,指向 ISCE2 的安装根目录(通常是 Conda 环境的根目录)
export ISCE_HOME=$HOME/tools/isce
# 2. 将 ISCE2 的应用程序目录添加到 PATH
# 这样您就可以直接运行 topsApp.py 等命令
export PATH=$ISCE_HOME/bin:$ISCE_HOME/applications:$PATH
export LD_LIBRARY_PATH=$ISCE_HOME/lib:$LD_LIBRARY_PATH
# 3. 将 ISCE2 Python 模块的父目录添加到 PYTHONPATH
# 这样 Python 解释器可以找到并导入 'isce' 模块
export PYTHONPATH=$ISCE_HOME:$ISCE_HOME/applications:$ISCE_HOME/components:$ISCE_HOME/library:$HOME/tools:$PYTHONPATH- 也可以直接在系统配置文
~/.bashrc
中加入以上代码并运行source ~/.bashrc
即可。
- 可以在目录
-
安装验证:
在terminal中运行:
1
2
3
4python3 -c "import isce"
topsApp.py --help --steps
# if you compiled mdx
mdx # or mdx.py