Skip to content

1_Installation

Yu Morishita edited this page Mar 19, 2021 · 17 revisions

1. Installation

1.1. Python3 and Required Modules

LiCSBAS needs following modules in Python3.

  • astropy
  • beautifulsoup4
  • gdal
  • h5py
  • matplotlib
  • numpy
  • psutil
  • requests
  • shapely (optional, only for LiCSBAS_contour.py)
  • statsmodels
  • cupy (if use GPU)

Example 1. Using Anaconda

One of the easiest ways to prepare the environment is installing Anaconda. Anaconda includes all required modules except gdal and shapely. After installing Anaconda, install gdal and shapely, e.g., by

conda install gdal shapely

Example 2. Using Miniconda and LiCSBAS.yml

Otherwise you can use Miniconda (minimal installer for conda) and LiCSBAS.yml to install only the required modules. After installing Miniconda,

conda env create -f LiCSBAS.yml
conda activate licsbas

will create and activate an "licsbas" environment (see also Managing environments).

Example 3. Install in existing virtual environment

If you have already created the virtual environment for LiCSBAS, you can install the required modules using LiCSBAS_requirements.txt by:

conda install --file LiCSBAS_requirements.txt

Example 4. Install from Anaconda or Miniconda without being root

To install Anaconda or Miniconda without being root, pyenv is one of the easiest ways. If you are not familiar with configuring the python environment, just run the following commands in bash:

### Install pyenv and pyenv-virtualenv
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
git clone https://github.com/pyenv/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init -)"\nfi' >> ~/.bash_profile
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile
source ~/.bash_profile
### Install miniconda and licsbas environment
pyenv install miniconda3-latest
pyenv shell miniconda3-latest
wget https://raw.githubusercontent.com/yumorishita/LiCSBAS/master/LiCSBAS.yml
conda env create -f LiCSBAS.yml
pyenv global miniconda3-latest/envs/licsbas

1.2. LiCSBAS Module

cd <your_LiCSBAS_path>
git clone https://github.com/yumorishita/LiCSBAS.git

Then,

source <your_LiCSBAS_path>/LiCSBAS/bashrc_LiCSBAS.sh

You may add the line above to your ~/.bashrc or ~/.bash_profile.

1.3. Check Install

To check if the install is OK or not, run:

LiCSBAS_check_install.py

If LiCSBAS install is OK is displayed at the bottom line, the install is OK.