Skip to content

Installing WESTPA

Jeremy M. G. Leung edited this page Apr 26, 2024 · 33 revisions

Table of Contents

Installing WESTPA 2.0 (v2022.XX)

We have streamlined the installation of WESTPA by leveraging conda-forge and PyPI for the package distribution. Described below are several scenarios that may be pertinent to your compute environment.

Installing with Conda (Recommended)

1. Install Anaconda or Miniconda. For instructions, see here.

2. Set up and activate a conda environment (Python 3.8 or higher.)

    conda create -n westpa2 python=3.11
    conda activate westpa2

3. Install the latest WESTPA version (v2022.XX)

    conda install -c conda-forge westpa

If you're having trouble installing, run conda config --add channels conda-forge to add conda-forge as one of the channels to look for dependencies.

Installing from PyPI

Even if you've chosen to install from PyPI, we still recommend installing Anaconda or Miniconda as a Python version control. For instructions, see here.

1. Set up and activate a development conda environment (Python 3.8 or higher)

    conda create -n westpa2 python=3.11
    conda activate westpa2

2. Install the latest WESTPA version (v2022.XX)

    python -m pip install westpa

NOTE: If you're on Apple Silicon (M1 Macs or later), you might have to manually install ``hdf5`` for the installation to run properly. One of our upstream dependencies (PyTables) requires building from source on Apple Silicon. You may install it with homebrew ``brew install hdf5`` or in conda ``conda install hdf5`` before installing ``westpa`` from PyPI using the command in Step 2.

Installing from source (Not Recommended)

See the Setting Up a Development Environment page.

Using external Python packages with WESTPA

If a user wishes to utilize a Python package such as OpenMM or MDTraj while running WESTPA, a separate conda environment can be created with WESTPA and the desired packages. An example of how this can be done is shown below.

conda create -n westpa-openmm -c conda-forge -c omnia westpa openmm mdtraj

Where westpa-openmm is the name given to this unique environment. The user will now be able to use OpenMM and MDTraj within WESTPA by activating that environment with conda activate westpa-openmm. Similarly, the environment can be deactivated with conda deactivate.

AmberTools and GROMACS can be installed in the same manner.

Creating such an environment is necessary for completing the Basic NaCl tutorial found in our suite of tutorials.

Installing WESTPA 1.0 (v2020.XX) - Legacy

We have streamlined the installation of WESTPA by leveraging conda-forge for the package distribution. Described below are several scenarios that may be pertinent to your compute environment.

User has Miniconda or Anaconda installed

In this scenario, you can perform the WESTPA installation in one of two ways:

Inside a virtual environment

Installing packages within a conda environment is considered the best practice approach. This method works even if the user does not have write permission to the Python installation prefix (for example, if you do not have sudo priviledge). In this case, the environment will be installed in the user's $HOME directory. You may need to update conda and the base environment first using

conda update conda
conda update --all

WESTPA can be installed into a conda environment named westpa-2020.06 by executing the following commands on a terminal

conda create --yes -n westpa-2020.06 -c conda-forge westpa=2020.06

The workflow for using WESTPA will consist of the following steps

conda activate westpa-2020.06
{Perform WESTPA simulations}
conda deactivate

where {Perform WESTPA simulations} is where you perform your molecular dynamics sampling, for example, and the conda activate westpa-2020.06 and conda deactivate are the standard commands for powering up and for powering down your virtual environment, respectively.

As a package within Miniconda or Anaconda

This approach only works if you have write permission within the Python installation prefix (for example, if you have sudo privilege or if Python was installed within your $HOME. You may need to update conda and the base environment first using

conda update conda
conda update --all

WESTPA installation uses the standard conda install <package> syntax:

conda install -c conda-forge westpa

To initialize the WESTPA environment prior to performing simulations, you need to execute the following commands

export ENV_PREFIX="$(dirname $(dirname `which python3`))"
. $ENV_PREFIX/westpa-2020.06/westpa.sh

These commands can be placed inside your ~/.bashrc file. The WESTPA environment will then automatically initialize every time you log in, and the tools become available for use.

User does not have Miniconda or Anaconda installed

In this case, we provide a script that will install Miniconda followed by WESTPA. The script can be downloaded from the WESTPA github repository by executing the following on a terminal

curl -LO https://raw.githubusercontent.com/westpa/westpa/master/miniconda_install_westpa.sh

Next, change the script to be executable and run it using

chmod +x miniconda_install_westpa.sh
./miniconda_install_westpa.sh <INSTALLATION_PREFIX>

where <INSTALLATION_PREFIX> is the directory path where you want to install Miniconda and where you have write permission. For example, this can be $HOME/my_packages/Miniconda3. Following installation of Miniconda, the script will automatically install WESTPA into a virtual environment named westpa-2020.06 using

conda create --yes -n westpa-2020.06 -c conda-forge westpa=2020.06

Note that you don't need to execute the above command. This is all taken care of inside the provided script and mirrors exactly the commands shown in the above section Inside a virtual environment. Assuming conda is configured correctly,

conda activate westpa-2020.06

will make the WESTPA tools available on the command line. To exit the WESTPA environment after completing WESTPA simulations, you execute the standard conda deactivate.

The provided installation script is well documented internally with step-wise comments. It is a good starting point if you are interested in understanding the installation workflow or in a Bash scripting example.

Clone this wiki locally