Cheminformatics Tutorials - Herong's Tutorial Examples - v2.03, by Herong Yang
Build RDKit from Source Code on CentOS System
This section provides a tutorial example on how to install RDKit from source code on CentOS Linux systems, using GCC C/C++, make, cmake tools.
If you cannot any way to install RDKit from a pre-compiled binary package on your CentOS system, you can follow what I did to build it from source code.
1. Go to the RDKit GitHub site at https://github.com/rdkit/rdkit.
2. Click "Clone or Download" and save the download file as rdkit-master.zip.
3. Unzip rdkit-master.zip in home directory and rename the resulting directory as ~/rdkit (full path is /home/herong/rdkit).
4. Install required tools and third party header/library files.
herong$ sudo dnf install cmake Installed: cmake-3.11.4-3.el8.x86_64 cmake-data-3.11.4-3.el8.noarch cmake-filesystem-3.11.4-3.el8.x86_64 cmake-rpm-macros-3.11.4-3.el8.noarch libuv-1:1.23.1-1.el8.x86_64 herong$ sudo dnf install tk-devel Installed: tk-devel-1:8.6.8-1.el8.x86_64 libX11-devel-1.6.7-1.el8.x86_64 libXau-devel-1.0.8-13.el8.x86_64 libXft-devel-2.3.2-10.el8.x86_64 libXrender-devel-0.9.10-7.el8.x86_64 libxcb-devel-1.13-5.el8.x86_64 tk-1:8.6.8-1.el8.x86_64 xorg-x11-proto-devel-2018.4-1.el8.noarch bzip2-devel-1.0.6-26.el8.x86_64 expat-devel-2.2.5-3.el8.x86_64 fontconfig-devel-2.13.1-3.el8.x86_64 freetype-devel-2.9.1-4.el8.x86_64 libpng-devel-2:1.6.34-5.el8.x86_64 libuuid-devel-2.32.1-17.el8.x86_64 tcl-1:8.6.8-2.el8.x86_64 tcl-devel-1:8.6.8-2.el8.x86_64 zlib-devel-1.2.11-10.el8.x86_64 herong$ sudo dnf install readline-devel Installed: readline-devel-7.0-10.el8.x86_64 ncurses-c++-libs-6.1-7.20180224.el8.x86_64 ncurses-devel-6.1-7.20180224.el8.x86_64 herong$ dnf info zlib-devel Installed Packages Name : zlib-devel Version : 1.2.11 Release : 10.el8 herong$ dnf info bzip2-devel Installed Packages Name : bzip2-devel Version : 1.0.6 Release : 26.el8 herong$ sudo dnf install sqlite-devel Upgraded: sqlite-3.26.0-4.el8_1.x86_64 sqlite-libs-3.26.0-4.el8_1.x86_64 Installed: sqlite-devel-3.26.0-4.el8_1.x86_64 herong$ sudo dnf install boost-devel Installed: boost-devel-1.66.0-6.el8.x86_64 boost-1.66.0-6.el8.x86_64 boost-container-1.66.0-6.el8.x86_64 boost-context-1.66.0-6.el8.x86_64 boost-coroutine-1.66.0-6.el8.x86_64 boost-fiber-1.66.0-6.el8.x86_64 boost-filesystem-1.66.0-6.el8.x86_64 boost-graph-1.66.0-6.el8.x86_64 boost-locale-1.66.0-6.el8.x86_64 boost-log-1.66.0-6.el8.x86_64 boost-math-1.66.0-6.el8.x86_64 boost-serialization-1.66.0-6.el8.x86_64 boost-signals-1.66.0-6.el8.x86_64 boost-stacktrace-1.66.0-6.el8.x86_64 boost-test-1.66.0-6.el8.x86_64 boost-timer-1.66.0-6.el8.x86_64 boost-type_erasure-1.66.0-6.el8.x86_64 boost-wave-1.66.0-6.el8.x86_64 libquadmath-devel-8.3.1-4.5.el8.x86_64 libicu-devel-60.3-1.el8.x86_64 libquadmath-8.3.1-4.5.el8.x86_64
5. Install Python 2 and required "boost" package. This is not needed. If you just want to use RDKit a C++ library.
herong$ python2 --version Python 2.7.16 herong$ sudo pip2 install boost Successfully installed blurhash-1.1.4 boost-0.1 certifi-2020.4.5.1 chardet-3.0.4 decorator-4.4.2 idna-2.9 python-dateutil-2.8.1 python-magic-0.4.15 pytz-2019.3 requests-2.23.0 six-1.14.0 sqlalchemy-1.3.16 urllib3-1.25.8 ...
6. check build tools:
herong$ gcc --version gcc (GCC) 8.3.1 20190507 (Red Hat 8.3.1-4) herong$ g++ --version g++ (GCC) 8.3.1 20190507 (Red Hat 8.3.1-4) herong$ make --version GNU Make 4.2.1 herong$ cmake --version cmake version 3.11.4
7. Prepare the build diretory:
herong$ mkdir ~/rdkit/build herong$ cd ~/rdkit/build
8. Run "cmake" to prepare "Makefile" with Python 3 wrapper turned off from the build directory. Only one library missing, Eigen3, impacting Descriptors3D module.
herong$ pwd /home/herong/rdkit/build herong$ cmake -DRDK_BUILD_PYTHON_WRAPPERS=OFF .. -- The C compiler identification is GNU 8.3.1 -- The CXX compiler identification is GNU 8.3.1 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done ... -- Could NOT find Eigen3 (missing: EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK) (Required is at least version "2.91.0") Eigen3 not found, disabling the Descriptors3D build. ... Downloading https://github.com/schrodinger/maeparser/archive/v1.2.3.tar.gz... Downloading https://github.com/schrodinger/coordgenlibs/archive/v1.4.0.tar.gz... Downloading https://github.com/rareylab/RingDecomposerLib/archive/v1.1.3_rdkit.tar.gz... Downloading https://github.com/Tencent/rapidjson/archive/v1.1.0.tar.gz... -- Configuring done -- Generating done -- Build files have been written to: /home/herong/rdkit/build
9. Run "make" to compile all source code files. This may take some time, and generate some warning messages.
herong$ make Scanning dependencies of target RDGeneral [ 4%] Building CXX object Code/RDGeneral/CMakeFiles/RDGeneral.dir/Invariant.cpp.o [ 4%] Building CXX object Code/RDGeneral/CMakeFiles/RDGeneral.dir/types.cpp.o [ 4%] Building CXX object Code/RDGeneral/CMakeFiles/RDGeneral.dir/utils.cpp.o [ 5%] Building CXX object Code/RDGeneral/CMakeFiles/RDGeneral.dir/RDLog.cpp.o [ 5%] Building CXX object Code/RDGeneral/CMakeFiles/RDGeneral.dir/LocaleSwitcher.cpp.o [ 5%] Building CXX object Code/RDGeneral/CMakeFiles/RDGeneral.dir/versions.cpp.o [ 5%] Linking CXX shared library ../../lib/libRDKitRDGeneral.so [ 5%] Built target RDGeneral ... [100%] Linking CXX shared library ../../lib/libRDKitChemicalFeatures.so [100%] Built target ChemicalFeatures Scanning dependencies of target testChemicalFeatures [100%] Building CXX object Code/ChemicalFeatures/CMakeFiles/... [100%] Linking CXX executable testChemicalFeatures [100%] Built target testChemicalFeatures
9. Run "make install" to build and install shared object (dynamic) *.so libraries.
herong$ make install [ 0%] Built target catch [ 0%] Built target inchi_support [ 0%] Built target maeparser [ 0%] Built target coordgen_support [ 1%] Built target maeparser_static [ 3%] Built target coordgen [ 5%] Built target coordgen_static [ 5%] Built target RDGeneral [ 6%] Built target DataStructs [ 7%] Built target RDGeometryLib [ 9%] Built target RingDecomposerLib [ 12%] Built target GraphMol ... [ 99%] Built target SimDivPickers [ 99%] Built target pickersTestsCatch [ 99%] Built target testSimDivPickers [ 99%] Built target InfoTheory_static [ 99%] Built target InfoTheory [ 99%] Built target ChemicalFeatures_static [100%] Built target ChemicalFeatures [100%] Built target testChemicalFeatures Install the project... -- Install configuration: "Release" -- Installing: /home/herong/rdkit/lib/cmake/rdkit/rdkit-targets.cmake -- Installing: /home/herong/rdkit/lib/cmake/rdkit/rdkit-targets-release.cmake -- Installing: /home/herong/rdkit/lib/cmake/rdkit/rdkit-config.cmake -- Installing: /home/herong/rdkit/lib/cmake/rdkit/rdkit-config-version.cmake -- Installing: /home/herong/rdkit/lib/libRDKitmaeparser.so.1.2020.09.1dev1 -- Installing: /home/herong/rdkit/lib/libRDKitmaeparser.so.1 -- Installing: /home/herong/rdkit/lib/libRDKitmaeparser.so -- Installing: /home/herong/rdkit/lib/libRDKitmaeparser_static.a -- Up-to-date: /home/herong/rdkit/lib/libRDKitmaeparser.so.1.2020.09.1dev1 -- Up-to-date: /home/herong/rdkit/lib/libRDKitmaeparser.so.1 -- Up-to-date: /home/herong/rdkit/lib/libRDKitmaeparser.so -- Installing: /home/herong/rdkit/lib/libRDKitcoordgen.so.1.2020.09.1dev1 -- Installing: /home/herong/rdkit/lib/libRDKitcoordgen.so.1 -- Installing: /home/herong/rdkit/lib/libRDKitcoordgen.so ... -- Set runtime path of "/home/herong/rdkit/lib/libRDKitGraphMol.so.1.2020.09.1dev1" to "" -- Installing: /home/herong/rdkit/lib/libRDKitGraphMol_static.a -- Installing: /home/herong/rdkit/lib/libRDKitDepictor.so.1.2020.09.1dev1 -- Installing: /home/herong/rdkit/lib/libRDKitDepictor.so.1 -- Installing: /home/herong/rdkit/lib/libRDKitDepictor.so -- Set runtime path of "/home/herong/rdkit/lib/libRDKitDepictor.so.1.2020.09.1dev1" to "" -- Installing: /home/herong/rdkit/lib/libRDKitDepictor_static.a -- Installing: /home/herong/rdkit/lib/libRDKitSmilesParse.so.1.2020.09.1dev1 -- Installing: /home/herong/rdkit/lib/libRDKitSmilesParse.so.1 -- Installing: /home/herong/rdkit/lib/libRDKitSmilesParse.so ... -- Installing: /home/herong/rdkit/lib/libRDKitChemicalFeatures_static.a
10. Run "ctest" to verify installation.
herong$ export RDBASE=/home/herong/rdkit herong$ ctest Test project /home/herong/rdkit/build Start 1: testCoordGen 1/104 Test #1: testCoordGen ........................... Passed 0.20 sec Start 2: testDict 2/104 Test #2: testDict ............................... Passed 0.59 sec Start 3: testRDValue 3/104 Test #3: testRDValue ............................ Passed 0.00 sec Start 4: testDataStructs 4/104 Test #4: testDataStructs ........................ Passed 0.00 sec Start 5: testFPB 5/104 Test #5: testFPB ................................ Passed 0.00 sec ... Start 100: testQuery 100/104 Test #100: testQuery .............................. Passed 0.00 sec Start 101: testMatCalc 101/104 Test #101: testMatCalc ............................ Passed 0.00 sec Start 102: testSimDivPickers 102/104 Test #102: testSimDivPickers ...................... Passed 0.00 sec Start 103: pickersTestsCatch 103/104 Test #103: pickersTestsCatch ...................... Passed 0.03 sec Start 104: testChemicalFeatures 104/104 Test #104: testChemicalFeatures ................... Passed 0.00 sec 100% tests passed, 0 tests failed out of 104 Total Test time (real) = 84.59 sec
Well done. I have the latest RDKit installed from source code on my CentOS 8 computer!
Table of Contents
SMILES (Simplified Molecular-Input Line-Entry System)
Open Babel: The Open Source Chemistry Toolbox
Using Open Babel Command: "obabel"
Generating SVG Pictures with Open Babel
Substructure Search with Open Babel
Similarity Search with Open Babel
Fingerprint Index for Fastsearch with Open Babel
Stereochemistry with Open Babel
Command Line Tools Provided by Open Babel
►RDKit: Open-Source Cheminformatics Software
Install RDKit in an Anaconda Environment
Install RDKit Binary Package for CentOS
►Build RDKit from Source Code on CentOS System
Compile, Link and Run RDKit C++ API Examples
Try Python API with RDKit Native Code
rdkit.Chem.rdchem - The Core Module
rdkit.Chem.rdmolfiles - Molecular File Module
rdkit.Chem.rdDepictor - Compute 2D Coordinates
rdkit.Chem.Draw - Handle Molecule Images
Molecule Substructure Search with RDKit
rdkit.Chem.rdmolops - Molecule Operations
Daylight Fingerprint Generator in RDKit
Morgan Fingerprint Generator in RDKit
RDKit Performance on Substructure Search
Introduction to Molecular Fingerprints
OCSR (Optical Chemical Structure Recognition)
AlphaFold - Protein Structure Prediction