Skip to content

pyCSAMT installation guide for Windows and Linux

Daniel03 edited this page Apr 13, 2022 · 8 revisions

Installation (10-04-2021)

on Windows 10

This guide explains how to install pyCSAMT on a Windows 10 system using Anaconda GUI and Anaconda Prompt.

noteTo use the full functionality of pyCSAMT, it's better to set a new environment to avoid conflicts of packages. Indeed, pyCSAMT can successfully run with basics python sub-packages especially when working without a modeling subpackage. However, when the modeling package is called, pyCSAMT will automatically install MTpy'toolkit with its required dependencies like geopandas, netcdf, pyyaml, gdal and libgdal. Therefore, it's recommended to create a new environment.

Install pycsamt using a terminal (Anaconda Prompt) or an anaconda GUI or depends on which platform you feel comfortable with. The installation can also be completed using an Anaconda Prompt.

Installation using Anaconda Prompt

  • you first need to create a new environment using conda create --name pycsamt
  • then activate the environment using conda activate pycsamt

Install required packages are not compulsory if you are already MTpy installed in your computer or if you are sure to not use the modeling module : But if your desired to use all functionalities, follow the the steps below and type:

  • conda install mtpy
  • conda install gdal libgdal geopandas netcdf4 pyyaml
  • pip install obspy # Not necessary especially when you want to use some main features of mtpy by calling mtpy from pycsamt environment

Note: It's also possible to skip the installation of the required sub-packages above the first time. And after pycsamt was installed, you may run the modeling subpackage and all required packages will be installed automatically as a subprocess.

After the steps above are carried out successfully :

  • change your directory to the location where you want pycsamt code to be cloned to the Anaconda terminal (like a Windows command prompt)
  • type DRIVE_LETTER: to change to the appropriate drive and cd path\to\directory to change directories.
  • Run the command git clone https://www.github.com/WEgeophysics/pyCSAMT
  • Once cloned, move into the cloned pyCSAMT directory with cd pyCSAMT

Installation using Anaconda GUI

Creating a new environment with Anaconda GUI following steps below.

  • After installing Anaconda, open the Anaconda Navigator app
  • In the left sidebar, select Environments, then at the bottom of the window select Create
  • Give your new environment a suitable name and select Python 3.7 as the package, then press the green Create button to confirm:

IstallationGUI

If you want to install mtpy manually as additional dependency, follow the following step below or click on the link to MTpy installation guide to see full of MTpy installation:

  • select the environment you have created from the list of available environments and in the packages window to the right,
  • select Not installed from the drop-down and enter mtpy in the search field
  • Select also the checkboxes next to gdal and libgdal, then click the Apply button in the lower right corner and a window will display confirming dependencies to install,
  • click Apply Repeat the process for the following additional packages: geopandas, netcdf4 and pyyaml.

IstallationGUI2

it's possible to run pycsamt in Anaconda Navigator from within the new environment created. The example below shows the effectiveness to run pycsamt on Spyder through Anaconda Navigator but it's also effective to run with PyCharm, etc.

IstallationGUI3

On Linux (Ubuntu 18.04)

Version 18.04 of Unbutu can be downloaded here and more used than Ubuntu 20.4. These instructions have been tested with Ubuntu version 18.04, however, if you are using a different distribution, the name of your package manager may be different as well as available package versions.

pycsamt can be installed on Linux with Anaconda to handle OS dependencies for you and actually, pycsamt have not been tested yet on Linux without Anaconda. If you use a GUI desktop environment with your Linux OS, then you can download Anaconda for your OS (https://www.anaconda.com/distribution/) and follow the Anaconda GUI instructions above.

If you use the terminal by running the Ubuntu server, follow these instructions:

Visit https://repo.anaconda.com/archive/ to find the latest or desired Linux install script (e.g. Anaconda3-2020.02-Linux-x86_64.sh)

  • download the script with curl -O https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh (Adjusting script with your current version)
  • run the script with ./Anaconda3-2020.02-Linux-x86_64.sh
  • create a new environment using conda create --name pycsamt
  • activate the environment using conda activate pycsamt
  • install required dependancies:
  • conda install mtpy gdal libgdal geopandas netcdf4 pyyaml

The following instructions are to install pycsamt

  • Change directory to the location where you want the pycsamt code to be cloned
  • Run the command git clone https://www.github.com/WEgeophysics/pyCSAMT
  • Once cloned, move into the cloned pyCSAMT directory with cd pycsamt

When using PyPI release, an additional step is required (thin now, you may skip this part)

  • Run the command pip install .
  • This command installs the pycsamt code as a package in your created Python environment.

About PyPI Installation

A PyPi release of pyCSAMT is also available and can be installed using:

  • pip install pycsamt
  • pip install --user pycsamt (for Window user)

However, it is recommended to install from the repository to get the latest development code.