Skip to content

MTPy installation guide for Windows

Bren Moushall edited this page Apr 2, 2020 · 2 revisions

Guide to install and setup MTPy

The purpose of this doc is to provide a guidance to install MTPy software environment in Windows PC

MTPy package can run in any Python2.7 as a long as suitable dependency packages are installed. However, we recommend the following:

  • use anaconda Python2 distribution, which is freely available.
  • use git-bash for Windows PC, as it is very similar to Linux bash, and much easier to use than Windows command.
  • install all necessary software into one directory, let's say, C:/mtpywin, so that it would NOT interfere with other software installations on your PC.

No administration privilege is required. A standard user can install these software packages.

It is advised that the software be installed in C-drive for IO performance, even though you can choose to install into an external drive, such as USB. All you need is enough free disk space, at least 5 GB. (If older versions of anaconda installed, consider to remove them to free up disk space)

Preparation

  1. create a directory/folder named mtpywin on C-drive
  2. download anaconda2 (Python 2.7) from continuum website: https://www.anaconda.com/download/
  3. download git-bash installer from: https://gitforwindows.org/ or https://git-scm.com/downloads

Install Git bash

run the Git installer to go through the installation process, use mostly default option, but customized option below:

git bash setup 1

git bash setup 2

git bash setup 1

Install anaconda python

Click to run the Anaconda2 installer

(This may take a while, more than 10 minutes to complete. Go for a coffee, or wait patiently until it finished successfully.)

use mostly default option, but customized option below:

set up anaconda 1

set up anaconda 2

set up anaconda 3

Configuration

modify the file C:/mtpywin/Git/etc/bash.bashrc

append the following lines to your bash.bashrc file

PACK_ROOT=/c/mtpywin # change this according to where you install /d/mtpywin

export PATH=$PACK_ROOT/anaconda2:$PACK_ROOT/anaconda2/Scripts:$PACK_ROOT/anaconda2/Library/bin:$PATH

export MATPLOTLIBRC=$PACK_ROOT/anaconda2/etc/

export PYTHONPATH=$PACK_ROOT/mtpy

export GDAL_DATA=$PACK_ROOT/anaconda2/Library/share/gdal

export MTPY_ROOT=$PACK_ROOT/mtpy

eval "cd $MTPY_ROOT"

Once the above steps are tested successful, you are ready to get mtpy and test run it.

open a terminal git-bash

cd /c/mtpywin

git clone https://github.com/MTgeophysics/mtpy.git

cd mtpy

run script to install dependency packages

If network connection has issue, you may need to configure https_proxy in the file $HOME/.condarc

bin/install_required_packages.bash

Optional step: override your existing matplotlibrc file to make matplotlib works

cp doc/config/matplotlibrc /c/mtpywin/anaconda2/etc/

Testing the installation

click the executable c:/mtpywin/Git/git-bash.exe (Alternatively click its desktop shortcut if created.)

Enter the following commands

python -V

git --version

This should show what you installed. do not be confused with older versions that might have been installed before.

Optionally, you can now configure you git bash terminal's look-and-feel through the manual option. See the example terminal look and feel below:

git bash option

Finally run the following script in the mtpy directory:

bin/check_mtpy_env.bash