Skip to content

MTPy installation guide for Linux system

Fei Zhang edited this page Apr 3, 2019 · 20 revisions

Introduction

MTPy package can be run in any Python2.7 as long as the required dependency packages are installed. However, we recommend use Anaconda Python distribution because of its many features including strong scientific flavor and free availability. No admin privilege is required to install the Anaconda Python software packages.

This wiki page will be focused on Anaconda Python installation for MTPy in Linux. If you use Windows PC, please see the installation guide for Windows.

Use VirtualBox to run Linux VM in a Windows (or Mac) Host.

A convenient option to get a Linux system is to use Oracle VirualBox, which is free downloadable from here.

After installing VirtualBox, the user can create a virtual guest OS such as Ubuntu-18.04.

(Note: In user training workshops, an Oracle Virtual Appliance (Ubuntu1804-mtpy.ova) file would be provided, which is about 5GB and can be directly imported into your VirtualBox. It contains all materials required for the Workshop, so that you will be able to run the Workshop exercises without the need of installation process.)

How to install Anaconda Python on Linux

The instruction below has been tested on Ubuntu Linux Version-18.04, and should work similarly in other types of Linux system. (As mentioned above, no admin privilege is required)

1) Obtain the installation package by click downloading

OR

Saving to: 'Anaconda2-5.2.0-Linux-x86_64.sh’

2) Change permission to run

  • chmod 755 Anaconda2-5.2.0-Linux-x86_64.sh¶

3) Run the installation script on command-line

  • ./Anaconda2-5.2.0-Linux-x86_64.sh

Welcome to Anaconda2 5.2.0

In order to continue the installation process, please review the license agreement. Please, press ENTER to continue

Accept the license and let it install into default directory location (/home/mtpy/anaconda2). This process will take a couple of minutes to complete. In the end when prompted, enter yes to make the new ananconda python PATH available by appending automatically a line of configuration into your $HOME/.bashrc, with output shown below:

[no] > yes

Appending source /home/mtpy/anaconda2/bin/activate to /home/mtpy/.bashrc A backup will be made to: /home/mtpy/.bashrc-anaconda2.bak

For this change to become active, you have to open a new terminal.

Thank you for installing Anaconda2!

========================================

Do you wish to proceed with the installation of Microsoft VSCode? [yes|no]

no

After the successful installation of Anaconda Python, open a new terminal and test to make sure your default python interpreter is /home/mtpy/anaconda2/bin/python, not your OS-provided python (/user/bin/python). Use the following commands:

  • python -V
  • which python
  • which jupyter-notebook

4) Install additional dependency python packages (gdal, pandas, geopandas and netcdf4)

  • conda install geopandas -y
  • conda install netcdf4 -y

Configure GDAL_DATA properly by appending in $HOME/.bashrc

  • echo 'export GDAL_DATA=/home/mtpy/anaconda2/share/gdal' >> /home/mtpy/.bashrc

  • export GDAL_DATA=/home/mtpy/anaconda2/share/gdal

5) Clone and install mtpy package using git

If git command is not installed, do sudo apt install git.

Obtain the mtpy source code:

See the README page for more tips on how to set up mtpy package in your development environment.

6) Test the installation

To test the installation, you simply need to start jupyter-notebook in command-line.

  • jupyter-notebook

Open a browser to navigate to run the examples/notebooks/MTPy-Installation-Guide-For-Ubuntu-Linux.ipynb.

Clone this wiki locally