Python binding for openbabel
might be not trivial to install on HPC cluster.
Simple pip install openbabel
are very likely to fail. Sample error messages are like:
Error: SWIG failed. Is Open Babel installed? You may need to manually specify the location of Open Babel include and library directories. For example: python setup.py build_ext -I/usr/local/include/openbabel-2.0 -L/usr/local/lib python setup.py install ----------------------------------------
First, check if swig
is installed or loaded in the HPC system.
The build process requires it, although the website of openbabel
does not specify.
The setup.py
of openbabel Python-binding may be a bit messy.
As indicated by the error message, the include and library paths needed to be specified.
To find the actual version of openbabel
that is linked in the HPC, run something like:
env | grep openbabel
where the root path of openbabel installed may be like /cluster/apps
/openbabel/
.
You can specify these parameters via the global_option
, like:
OPENBABEL_DIR=/cluster/apps/openbabel/2.4.1/x86_64 #Change it according to your system pip install --global-option=build_ext --global-option="-I$OPENBABEL_DIR/include/openbabel-2.0" --global-option="-L$OPENBABEL_DIR/lib" openbabel
Note the suffix openbabel-2.0
must be present. Generally after these steps the Python binding should be installed smoothly.