Installing GWpy

GWpy can be installed on the following platforms

Mac OS X

The recommended way to install GWpy on Mac OS X is to install the dependencies via MacPorts.

Follow these instructions to install the MacPorts package on your Mac, then execute the following command to install the required dependencies for GWpy:

sudo port install python27 python_select py27-numpy py27-scipy py27-matplotlib +latex +dvipng texlive-latex-extra py27-astropy glue
sudo port select --set python python27

You can also run the following to install a number of optional dependencies - packages that, when present, enhance the functionality of GWpy:

sudo port install py27-ipython nds2-client kerberos5 py27-pykerberos py27-h5py py27-lal py27-ldas-tools-framecpp

Once you have at least the required dependencies installed, you can install GWpy using pip.

Linux

The GWpy package has the following build-time dependencies (i.e. required for installation):

You should install these packages on your system using the instructions provided by their authors.

You can also install the following optional dependencies - packages that, when present, enhance the functionality of GWpy:

Once you have at least the required dependencies installed, you can install GWpy using pip.

Pip

The easiest way to install GWpy is to use pip. You can install pip very easily with MacPorts and most linux-based package managers.

Once you have pip installed:

pip install --user gwpy

The --user option tells the installer to copy codes into the standard user library path, on linux machines this is

~/.local/lib

while on Mac OS this is

~/Library/Python/X.Y/lib

where X.Y is the python major and minor version numbers, e.g. 2.7. For either operating system, python will automatically know about these directories, so you don’t have to fiddle with any environment variables.

Warning

GWpy is still under major version 0, meaning a completely stable state has no been reached. Until that time, backwards-incompatible changes may be made without much warning, but developers will strive to keep these events to a minimum.

GitHub

Any user can install the latest development version of GWpy by directing pip to the GWpy GitHub repository:

pip install --user git+https://github.com/gwpy/gwpy

Warning

The latest developments are not guaranteed to be free of bugs, and so you should only install from GitHub if you really need to.

Source

The source code for GWpy is under git version control, hosted by http://github.com. You can clone the repository from the Terminal as follows:

git clone https://github.com/gwpy/gwpy.git

You can then, if you wish, install the package by running the setup.py script as follows:

cd gwpy
pip install -r requirements.txt
pip install .

Warning

Users have reported an issue with installation on Mac OS using the anaconda python distribution. The GWpy install might raise the following exception:

ValueError: unknown locale: UTF-8

In this instance, you can resolve the issue by setting the following environment variables in your bash shell:

export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

or in csh:

setenv LANG en_US.UTF-8
setenv LC_ALL en_US.UTF-8

Virtualenv

The GWpy group provides a virtualenv helper called GWpySoft to simplify installing GWpy and its dependencies as part of a stand-alone virtualenv installation. To install using this solution you just need to clone the repo and run the gwpysoft-init script:

$ git clone https://github.com/gwpy/gwpysoft
$ cd gwpysoft
$ ./gwpysoft-init ~/opt/gwpysoft ./packages.txt

The ~/opt/gwpysoft argument is the target directory for the virtualenv and can be replaced with anything you like, similarly ./packages.txt contains the list of packages to install in the pip requirements.txt format.

Available installations

If you are a member of the LIGO Scientific Collaboration, a virtualenv is available for you to use on the LIGO Data Grid, providing an isolated environment including GWpy and its dependencies.

How you enter this environment depends on which shell you are using:

Bash

. ~detchar/opt/gwpysoft/bin/activate

Csh

. ~detchar/opt/gwpysoft/bin/activate.csh

In either case, once you are finished with your work, if you want to return to your original environment, you can deactivate the virtualenv:

deactivate