This file provides information on how to setup a development environment for HADDOCK3.
- Python 3.9
- OpenMPI
Below the instructions are provided for a Ubuntu system using apt-get
. If you are using a different system, please refer to the respective package manager - yum
, dnf
, pacman
, homebrew
, port
, etc.
sudo apt-get update &&
# Needed for building Python
sudo apt-get install build-essential python-setuptools python-pip &&
sudo apt-get install libncursesw5-dev libgdbm-dev libc6-dev &&
sudo apt-get install zlib1g-dev libsqlite3-dev tk-dev &&
sudo apt-get install libssl-dev openssl &&
sudo apt-get install libffi-dev &&
# Needed for haddock3 installation
sudo apt-get install git gcc &&
# Needed to run the MPI related tests
sudo apt-get install openmpi-bin libopenmpi3 libopenmpi-dev
After all the system-dependencies are in place, download and compile python.
Conda is NOT recommended for development
wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz
tar -xf Python-3.9.6.tgz
cd Python-3.9.6
./configure --enable-optimizations
sudo make altinstall -j 8
Then python3.9
should be available on your system at /usr/local/bin/python3.9
On OSX, you can use a package-manager such as brew to install Python 3.9.
Please keep in mind installing python with a package manager can mask system dependencies that your development might add. That's why we recommended you install it from source.
brew install [email protected]
git clone https://github.com/haddocking/haddock3.git
cd haddock3
We recommend you use Python's native virtual environment to manage the dependencies.
python3.9 -m venv .venv
source .venv/bin/activate
Install both project dependencies and test dependencies using pip.
pip install -e '.[dev,docs]'
If you are using a Mac, if the installation of mpi4py fails, run first
brew install mpi4py
In haddock3
we use the pytest framework, make sure you check it's documentation the tests are located in tests/
(unit) and integration_tests/
directories.
pytest tests/
pytest integration_tests/
Depending on your architecture, the CNS executable coming with the pip install
command (see above), might give errors because of some missing libraries.
In such a case you should recompile CNS (see the CNS.md
file in the docs
directory). Once you have tested your newly compiled executable you can place it in the install haddock3 version. For this do the following:
- First get the location where haddock3 has been installed:
> pip show haddock3
Name: haddock3
Version: 2024.10.0b7
Summary: HADDOCK3
Home-page:
Author:
Author-email: BonvinLab <[email protected]>
License: Apache License 2.0
Location: /home/testuser/.venv/lib/python3.9/site-packages
...
- Copy your CNS executable to the haddock3 installation:
> cp <cns.binary> /home/testuser/.venv/lib/python3.9/site-packages/haddock/bin/cns
Please get in contact with the system administrator before doing development in a shared HPC environment.
For installation in an HPC environment we recommend to check the installed Python versions on the system and also importantly if an openmpi
(or other custom MPI) installation is available on the system.
Those are often offered via the module
command.
If you only intend to develop haddock3 using the multiprocessing scheduler, the above instructions should be fine. But to harvest the MPI capabilities of an HPC system it is best to build haddock3 using the installed MPI version on the HPC system.