Wednesday, August 30, 2017

Methods for installing Python and ObsPy (8/30/2017)

Methods for installing Python and ObsPy (8/30/2017)


First: Install larger software package Anaconda

from this page, you can download Anaconda 4.4.0 and Python 3.6.1

Once installed on a MacOS device, there will be a subdirectory “anaconda” added to your home directory, in my case /Users/jjpark/anaconda

Anaconda has a GUI interface called Anaconda Navigator that you can access with a click from the anaconda subdirectory, or else put an alias in your Dock in MacOS.  Th ObsPy home pages, however, direct you to install ObsPy within Anaconda via command-line entries with the executable “conda”

To make these operations easier on a Mac or Linux computer, drag Anaconda Navigator to your Applications folder and add “/Users/xxx/anaconda/bin” to your path variable in the file .cshrc, e.g.,

set path = (/Users/jjpark/anaconda/bin $path)

Make sure that you login to a new or existing terminal window to re-execute the startup file .cshrc.

HOWEVER, it appears that Anaconda likes to run in the BASH shell, not C-shell, because Anaconda creates a .bash_profile file in your home directory that points the PATH variable for the BASH shell to ~/anaconda/bin.

so enter the BASH shell, type


Getting the conda command working:

my first commands, checking the versions of the downloaded software, then updating:

-> conda --version
conda 4.3.21
-> python --version
Python 3.6.1 :: Anaconda 4.4.0 (x86_64)
-> conda update conda
Fetching package metadata .........
Solving package specifications: .

Package plan for installation in environment /Users/jjpark/anaconda:

The following packages will be UPDATED:

    conda: 4.3.21-py36_0 --> 4.3.25-py36_0

Proceed ([y]/n)? y

conda-4.3.25-p 100% |################################| Time: 0:00:00   1.58 MB/s

Use conda to list the software packages that you installed with Anaconda

-> conda list

Once you have installed Anaconda and Python, its time to install ObsPy

—> conda create -n obspy python

TO ACTIVATE the obspy environment, you need to run a command

bash-4.4$ source activate obspy

Install pre-compiled ObsPy conda package from Anaconda cloud with:
(obspy) $ conda install obspy


(obspy) $ conda update obspy

and use conda to list the software packages that are active in the obspy environment

(obspy) bash-4.4$ conda list
# packages in environment at /Users/jjpark/anaconda/envs/obspy:
ca-certificates           2017.7.27.1                   0    conda-forge
certifi                   2017.7.27.1              py36_0    conda-forge
ncurses                   5.9                          10    conda-forge

. . . . and many many more

Check that everything is working with

(obspy) bash-4.4$ obspy-runtests

Journal Articles with background on ObsPy