Friday, November 4, 2016

Twice as (n)ISCE

UPDATE (August 2020):


In honour of ISCE release 2.4, with the removal of the distasteful terminology that cluttered previous editions, I have been trying to install it on my Windows 10 PC (with Windows Subsystem for Linux 2, running Ubuntu 20.04).

I managed to get a clean clone of the isce2 repo to compile, but not without incident. I had to hack around with several files to get it to work.

Here is what I did...

Get the repo, link the directory:
git clone https://github.com/isce-framework/isce2
ln -s isce2 isce 

Install dependencies:
sudo apt install scons libfftw3-dev libxm4 libmotif-dev python3-dev python3-pip snaphu cython3 libgdal-dev python3-gdal libhdf5-dev opencv-python libopencv-dev

sudo apt install scipy numpy h5py

I had to edit some files (paths from the isce2 directory):

1) contrib/geo_autoRIFT/autoRIFT/bindings/autoriftcoremodule.cpp - insert 
#include "opencv2/imgproc/types_c.h"
after the other include commands

2) components/zerodop/SConscript - commented out statements from line 36 to end
3) PyCuAmpcor/SConscript - commented out statements from line 14 to end
4) test/SConscript - commented out statements from line 23 to end

2) and 3) caused the compilation to crash, as I was not compiling with CUDA. You probably need them if you are. 

My new .isce/SConfigISCE : 

PRJ_SCONS_BUILD = /home/gareth/pkgs/isce/build
PRJ_SCONS_INSTALL = /home/gareth/pkgs/isce/isce

LIBPATH = /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial /usr/local/lib /home/gareth/pkgs/isce/lib /home/gareth/pkgs/isce/lib64 /home/gareth/pkgs/isce/lib32 

CPPPATH = /usr/include/python3.8 /usr/include/python3.8/numpy /usr/include/hdf5/serial /usr/include/gdal /usr/include/opencv4 

FORTRANPATH =  /usr/include
FORTRAN = /usr/bin/gfortran
CC = /usr/bin/gcc
CXX = /usr/bin/g++

MOTIFLIBPATH = /usr/lib/x86_64-linux-gnu
X11LIBPATH = /usr/lib/x86_64-linux-gnu
MOTIFINCPATH = /usr/include  
X11INCPATH = /usr/include  

(substitute 'gareth' for your own username!)

My ISCE_config.sh script is now:

export ISCE_INSTALL_ROOT=/home/gareth/pkgs/isce
export PYTHONPATH=$ISCE_INSTALL_ROOT:$PYTHONPATH
export ISCE_HOME=$ISCE_INSTALL_ROOT/isce
export PATH=$ISCE_HOME/applications:$PATH  

(substitute /home/gareth/pkgs for wherever you cloned the github repo)

I added the following lines to the end of .bashrc to tell the shell about my install:
export SCONS_CONFIG_DIR=/home/gareth/.isce
source /home/gareth/pkgs/isce/ISCE_config.sh
(again, edit to point these to your own directories and script, whatever they are called)

When compiling, scons wasn't finding the dependencies, so 
scons install --config=force
gave it a bit more encouragement. And it ran to the end.

Good luck if you're trying it yourself! I'm off to provide 'feedback' on the process to the developers...


Original post:


This week I have mostly been trying to find a stable install strategy for ISCE under Ubuntu 16.04. Here's where I've got so far.

First, install some dependencies:
sudo apt-get install scons libfftw3-dev libxm4 libmotif-dev python3-dev python3-pip snaphu  
Install some Python 3 packages:
sudo pip3 install scipy
sudo pip3 install numpy
sudo pip3 install h5py
EDIT (May 2017): My install of the 20170403 version also required the 'cython' package installed...
 sudo pip3 install cython
EDIT (again; October 2017): My install of version 2.1 required 'cython3'. Easily done.
 sudo apt install cython3
The latest version requires gdal version 2.1.1, which is not available in the regular distribution of Ubuntu. So add the 'experimental' branch of Ubuntu GIS to your repository list, and get it from there:
sudo add-apt-repository ppa:ubuntugis/ubuntugis-experimental
sudo apt-get update
sudo apt-get install libgdal-dev python3-gdal libhdf5-dev
Next, I unpacked the latest tar file of the ISCE source code (WInSAR download credentials required) into a directory that I call 'pkgs' (for 'packages'). I then made a symbolic link to this directory (isce-2.1.0) in pkgs:
ln -s isce-2.1.0 isce
On top of this, you need to add a few text files and other things.

These are the contents of the configuration script ISCE_config.sh (note that 'administrator' is the username here, and I am installing ISCE in the directory /home/administrator/pkgs/isce):
export ISCE_INSTALL_ROOT=/home/administrator/pkgs/isce
export PYTHONPATH=$ISCE_INSTALL_ROOT:$PYTHONPATH
export ISCE_HOME=$ISCE_INSTALL_ROOT/isce
export PATH=$ISCE_HOME/applications:$PATH
ISCE is installed using the package scons via a configuration file called 'SConfigISCE'. This resides in a hidden directory (.isce) in your home directory. These are the contents of .isce/SConfigISCE:
PRJ_SCONS_BUILD = /home/administrator/pkgs/isce/build
PRJ_SCONS_INSTALL = /home/administrator/pkgs/isce/isce

LIBPATH=/usr/lib /usr/local/lib /home/administrator/pkgs/isce/lib /home/administrator/pkgs/isce/lib64 /home/administrator/pkgs/isce/lib32 /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial

CPPPATH = /usr/include/hdf5/serial /usr/include/gdal /usr/include/python3.5

FORTRANPATH =  /usr/include
FORTRAN = /usr/bin/gfortran
CC = /usr/bin/gcc
CXX = /usr/bin/g++

MOTIFLIBPATH = /usr/lib/x86_64-linux-gnu
X11LIBPATH = /usr/lib/x86_64-linux-gnu
MOTIFINCPATH = /usr/include  
X11INCPATH = /usr/include
    
I added the following lines to the end of .bashrc to tell the shell about them:
export SCONS_CONFIG_DIR=/home/administrator/.isce
source /home/administrator/pkgs/isce/ISCE_config.sh
Once all this is set up, open a fresh terminal window, head to your symlinked 'isce' directory, and run:
scons install
 And I wish you success... May all your interferograms be timely and beautiful!

2 comments:

  1. Hi G
    thank you for your sharing.
    but i have some mistake after scons install:
    root@administrator:/home/administrator/pkgs/isce# scons install
    scons: Reading SConscript files ...
    Error. Need to set the variable SCONS_CONFIG_DIR in the shell environment
    Exception: :
    File "/home/administrator/pkgs/isce/SConstruct", line 35:
    raise Exception
    Can you help me to fix it?

    ReplyDelete
  2. Maybe I should have made it a little clearer. These are the directories I have on my machine. Yours will almost certainly have different names.

    You should substitute the path to your home directory for '/home/administrator', and the path to your installation directory for '/home/administrator/pkgs/isce'. The error message you are getting is probably because the path associated with SCONS_CONFIG_DIR doesn't exist on your computer.

    ReplyDelete