Obtaining and installing PyRETIS

PyRETIS and its requirements can be installed using pip or using conda as described below. We also describe how PyRETIS can be installed in a virtual environment and how it can be installed directly from the source code using git.


Prerequisites

PyRETIS requires Python 3.6 or Python 3.7. Please make sure that you have an updated version of Python installed on your system. PyRETIS depends on several other Python packages, however, these should be installed automatically as part of the installation of PyRETIS. A list of the dependencies can be found below.


Installing via pip

PyRETIS can be installed using pip with the following command:

pip install pyretis

PyRETIS requires mdtraj and this has to be installed after installing PyRETIS:

pip install git+https://github.com/mdtraj/mdtraj.git

PyRETIS offers an analysis tool, named PyVisA. Its GUI requires PyQt5 to be executed. To install PyQt5 via pip:

pip install pyqt5

Note: Please make sure that you are using a Python environment of version 3.6 or newer. On some systems, Python 2 may still be the default version and pip might actually try to install for Python 2. In this case, use pip3 in the command above.


Installing via conda

PyRETIS can be installed using conda with the following commands:

conda create --name pyretis
conda activate pyretis
conda install pyretis -c conda-forge

PyRETIS offers an analysis tool, named PyVisA. Its GUI requires PyQt5 to be executed. To install PyQt5 via conda:

conda install pyqt -c conda-forge

Note: Since PyRETIS will only work with Python 3.6 or newer, please make sure that you are using an environment with a recent version of Python.


Optional: Setting up a virtual environment for pip

You can also install PyRETIS in a virtual environment. Using a virtual environment makes it easier to maintain different versions of PyRETIS and it’s dependencies. The following steps are needed to set up a virtual environment:

  1. Install the virtualenv package. This can be done using pip:

    [sudo] pip install virtualenv
    

    or using a package manager for your operative system, for instance apt if you are using a Debian-like Linux:

    [sudo] apt-get install virtualenv
    
  2. Create a folder dedicated to your virtual environments, for instance in your home directory:

    mkdir ~/name-of-environment-folder
    cd ~/name-of-environment-folder
    
  3. Install the new environment with the desired Python3 interpreter, using the path to the desired Python executable (usually found in /usr/bin/), and a name for the virtual environment folder (pyretis-env):

    virtualenv -p /usr/bin/python3 ~/name-of-environment-folder/pyretis-env
    

    Note, if you want more control over which version of Python to use, you can use the -p option in the command above to specify this. For instance, for version 3.7:

    virtualenv -p /usr/bin/python3.7 ~/name-of-environment-folder/pyretis-env
    
  4. Activate the environment:

    source ~/name-of-environment-folder/pyretis-env/bin/activate
    
  5. Install PyRETIS:

    pip install pyretis
    
  6. Install mdtraj:

    pip install git+https://github.com/mdtraj/mdtraj.git
    
  7. (Optional) PyVisA’s GUI requisites:

    pip install pyqt5
    

The folder ~/name-of-environment-folder/pyretis-env now contains a new Python environment where PyRETIS has been installed. Since you have sourced the virtual environment, pip will now refer to the version of pip installed in the environment and when you install packages, they will be installed inside the folder ~/name-of-environment-folder/pyretis-env.

Note: that you will have to source the environment each time you want to make use of it using the source command given above.


Optional: Installing from the PyRETIS git repository

Previous versions and the latest (possibly unstable) sources can be obtained using git:

git clone git@gitlab.com:pyretis/pyretis.git

or,

git clone https://gitlab.com/pyretis/pyretis.git

After cloning the repository, PyRETIS can be installed via pip (after navigating to the main source directory):

pip install .

or, alternatively:

python setup.py install

Then, install mdtraj:

pip install git+https://github.com/mdtraj/mdtraj.git

and, to be able to run PyVisA’s GUI, add pyqt5:

pip install pyqt5

Optional: Installing a development version from the PyRETIS git repository

After cloning the repository as described above, check out the development branch you are interested in, e.g.:

git checkout develop

Then install the development requirements (these are defined in the file requirements-dev.txt, note that they include pyqt5, which is not supported in some environments):

pip install -r requirements-dev.txt

install mdtraj:

pip install git+https://github.com/mdtraj/mdtraj.git

Finally, install PyRETIS using:

pip install -e .

Testing your installation

After installing from the PyRETIS source, your installation can be tested by running the tests from the main directory:

python -m unittest discover -v -s test

Requirements for PyRETIS

In order to run PyRETIS, several Python libraries are needed, for instance SciPy, NumPy, and matplotlib (see also the information on installing the SciPy Stack). A list of the requirements can be found in the file requirements.txt in the source code directory. These packages can be installed by:

pip install -r requirements.txt

after downloading the requirements.txt file. This should be automatically done if you are installing PyRETIS using pip/conda. Notes: (1) the mdtraj requirement may have to be installed separately as described above; (2) the analysis package PyVisA requires PyQt5, which has to be installed separately as described above.