Installation
Installing from source
These are instructions to install pygwb
, which runs on Python \(\ge3.8\).
Currently, there are 2 stable released versions (see the pygwb PyPi page for more details):
1.0.0
1.3.0
which may be installed using pip
:
$ pip install pygwb==[version]
Otherwise, you may install the cloned repository directly. If you already have an existing Python environment, you can simply clone the code and install in any of the usual ways.
$ git clone git@git.ligo.org:pygwb/pygwb.git
$ pip install .
$ git clone git@git.ligo.org:pygwb/pygwb.git
$ python setup.py install
You may also wish to install in “develop” mode.
$ git clone git@git.ligo.org:pygwb/pygwb.git
$ pip install -e .
$ git clone git@git.ligo.org:pygwb/pygwb.git
$ python setup.py develop
In develop mode, a symbolic link is made between the source directory and the environment site packages. This means that any changes to the source are immediately propagated to the environment.
Creating a python environment
We recommend working with a recent version of Python.
A good reference is to use the default anaconda version.
This is currently Python 3.8
(August 2021).
conda
is a recommended package manager which allows you to manage
installation and maintenance of various packages in environments. For
help getting started, see the LSCSoft documentation.
For detailed help on creating and managing environments see these help pages. Here is an example of creating and activating an environment named pygwb
$ conda create -n pygwb python=3.8
$ conda activate pygwb
virtualenv
is a similar tool to conda. To obtain an environment, run
$ virtualenv --python=/usr/bin/python3.8 $HOME/virtualenvs/pygwb
$ source virtualenvs/pygwb/bin/activate
To source a Python 3.8
installation on the LDG using CVMFS, run the
commands
$ source /cvmfs/oasis.opensciencegrid.org/ligo/sw/conda/etc/profile.d/conda.sh
$ conda activate igwn-py38
Documentation for this conda setup can be found here: https://computing.docs.ligo.org/conda/.
Installing Python
Most computers/clusters have a system-installed Python version. You may choose to use this, but here we describe an alternative. In particular, how to install the anaconda distribution Python package. Firstly, download the install file. You can do this from the link above, or run the command
$ wget https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-x86_64.sh
This will download an installer for Python 3.8. For other versions check the anaconda page. Then, run the command
$ bash Anaconda3-2021.05-Linux-x86_64.sh
and follow the prompts on the install screen. After this process, you should
have a directory ~/anaconda3
in your home directory. This contains your
Python installation. In particular, if you run the command
$ which python
/home/users/USER/anaconda3/bin/python
The output here (with a suitable replacement of the path) indicates that you
are using the anaconda install of Python. If instead, the output says something
like /usr/bin/python
, then this is not the anaconda installation, but
instead the system Python.
If you are finding that you have run the above steps, but python
is
not pointing to your anaconda install, make sure that (a) you have appended a
line like this to your .bashrc
file
export PATH="${HOME}/anaconda3/bin:$PATH"
and (b) that you have restarted bash for this line to take effect (i.e., run
$ bash
).
Note
Using your own installation of Python has several advantages: it’s generally easier to debug, avoids conflicts with other packages, and if you end up with a broken installation you can just delete the directory and start again.