Skip to content

Instantly share code, notes, and snippets.

@jglaser
Last active August 5, 2020 15:04
Show Gist options
  • Save jglaser/fe28e8e1fa318686f5eb741a6cb6cfe6 to your computer and use it in GitHub Desktop.
Save jglaser/fe28e8e1fa318686f5eb741a6cb6cfe6 to your computer and use it in GitHub Desktop.
Installing RDKit in a virtual environment on Linux
# assuming a python venv is active
# pixman
https://github.com/freedesktop/pixman
./autogen.sh --enable-shared --prefix=$VIRTUAL_ENV
make -j32 installl
# cairo
https://github.com/freedesktop/cairo
pixman_CFLAGS=-I$VIRTUAL_ENV/include/pixman-1 pixman_LIBS="-L$VIRTUAL_ENV/lib -lpixman-1" ./autogen.sh --enable-shared --prefix=$VIRTUAL_ENV
# modify Makefile, test/Makefile and perf/Makefile
# CAIRO_LDFLAGS=-lpixman-1
make -j32 install
# boost
wget https://dl.bintray.com/boostorg/release/1.73.0/source/boost_1_73_0.zip
unzip boost_1_73_0.zip
cd boost_1_73_0
echo "using python : 3.7 : /autofs/nccs-svm1_proj/stf006/glaser/envs/dask-rhea/bin/python : /autofs/nccs-svm1_sw/rhea/.swci/0-core/opt/spack/20191017/linux-rhel7-x86_64/gcc-8.4.0/python-3.7.0-wzhv7pvt65hidpkabp3tbntkvsemulpz/include/python3.7m : /autofs/nccs-svm1_sw/rhea/.swci/0-core/opt/spack/20191017/linux-rhel7-x86_64/gcc-8.4.0/python-3.7.0-wzhv7pvt65hidpkabp3tbntkvsemulpz/lib ;" > ~/user-config.jam
./bootstrap.sh --with-python=`which python`
./b2 install --prefix=$VIRTUAL_ENV
# eigen
git clone https://gitlab.com/libeigen/eigen.git
cd eigen
mkdir -p build
cd build
CMAKE_PREFIX_PATH=$VIRTUAL_ENV cmake -D CMAKE_INSTALL_PREFIX=$VIRTUAL_ENV ..
make -j 32 install
# pillow
pip install pillow
# numpy
# check if headers are already installed
python -c 'import numpy ; print(numpy.get_include())'
# otherwise, install numpy
# rdkit
git clone https://github.com/rdkit/rdkit.git
cd rdkit
mkdir -p build && cd build
module load cmake/3.14.2
module unload boost
CMAKE_PREFIX_PATH=$VIRTUAL_ENV cmake -DBoost_NO_BOOST_CMAKE=ON -DPy_ENABLE_SHARED=1 -DPYTHON_EXECUTABLE=$OLCF_PYTHON_ROOT/bin/python3 -DRDK_INSTALL_INTREE=ON -DRDK_INSTALL_STATIC_LIBS=OFF -DRDK_BUILD_CPP_TESTS=ON -DPYTHON_NUMPY_INCLUDE_PATH="$(python -c 'import numpy ; print(numpy.get_include())')" -DRDK_BUILD_INCHI_SUPPORT=ON -DBOOST_ROOT="$VIRTUAL_ENV" -DCMAKE_INSTALL_PREFIX=$VIRTUAL_ENV .. # ignore the warnings
make -j32 install
# rdkit doesn't know how to install properly
# add these lines to your $VIRTUAL_ENV/bin/activate, pointing
# it to the rdkit source location (after line 47)
########## Paths for RDKit
export RDBASE="/gpfs/alpine/scratch/glaser/bif128/rdkit"
export PYTHONPATH="$RDBASE"
export LD_LIBRARY_PATH="$RDBASE/lib:$VIRTUAL_ENV/lib:$LD_LIBRARY_PATH"
python -c "import rdkit" # test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment