How to install RDKit on Ubuntu 12.04 / 12.10 / 13.04 / 13.10 / 14.04 / 14.10 (with InChI support)

I make extensive use of this brilliant piece of cheminformatics software (RD)kit, and it has saved me writing my own Molecule, Atom, Bond, Conformer, Fingerprint, SimilarityMetric, Descriptor etc. classes time and time again.  It is really neat, and works with C++ and python (and Java I think).  Here are the instructions on how to install it on a relatively recent Ubuntu version (12.04 / 12.10 / 13.04 / 13.10 / 14.04 / 14.10).

Pre-requisite software (this is why I love Debian based systems)

sudo apt-get install flex bison build-essential python-numpy cmake python-dev sqlite3 libsqlite3-dev libboost-dev  libboost-python-dev libboost-regex-dev

Get the latest RDKit goodie from here (watch out – version number has been replaced by ‘X’ below)

wget http://downloads.sourceforge.net/project/rdkit/rdkit/QX_20XX/RDKit_20XX_XX_X.tgz

Unzip the beast, save it to /opt

sudo tar xzvf RDKit_20XX_XX_X.tgz -C /opt

Add some environment salt, vim ~/.bashrc

export RDBASE=/opt/RDKit_20XX_XX_X
export LD_LIBRARY_PATH=$RDBASE/lib:$LD_LIBRARY_PATH
export PYTHONPATH=$RDBASE:$PYTHONPATH

Resource your .bashrc

. ~/.bashrc

if you want the InChI stuff (trust me you do), first:

cd $RDBASE/External/INCHI-API/
./download-inchi.sh

Build (compile), install & test

cd $RDBASE
mkdir build
cd build
cmake .. # if you do not care for InChI support OR
cmake -DRDK_BUILD_INCHI_SUPPORT=ON .. # to install InChI generation code 
make # -j 4 to use multiple processors
make install
ctest

If all your tests passed successful you are good to go.  Otherwise, get in touch via the post comments below.

 

 

Author

6 thoughts on “How to install RDKit on Ubuntu 12.04 / 12.10 / 13.04 / 13.10 / 14.04 / 14.10 (with InChI support)

  1. Lingqi Luo

    Hi
    Extremely thanks for the detail instruction on how to install RDKit on ubuntu. I am trying to copy what you described on my ubuntu 12.10 and almost done with the whole procedure except the last ‘ctest’ failures as following. Do you happen to have any suggestions on this please? Thanks

    ###############################
    33% tests passed, 52 tests failed out of 78

    Total Test time (real) = 5.01 sec

    The following tests FAILED:
    2 – testDataStructs (OTHER_FAULT)
    3 – pyBV (Failed)
    4 – pyDiscreteValueVect (Failed)
    5 – pySparseIntVect (Failed)
    7 – testGrid (OTHER_FAULT)
    8 – testPyGeometry (Failed)
    11 – pyAlignment (Failed)
    14 – testMMFFForceField (OTHER_FAULT)
    16 – pyDistGeom (Failed)
    20 – graphmolMolOpsTest (SEGFAULT)
    22 – graphmoltestChirality (OTHER_FAULT)
    23 – graphmoltestPickler (OTHER_FAULT)
    25 – testDepictor (OTHER_FAULT)
    26 – pyDepictor (Failed)
    29 – fileParsersTest1 (OTHER_FAULT)
    30 – testMolSupplier (OTHER_FAULT)
    31 – testMolWriter (OTHER_FAULT)
    32 – testTplParser (OTHER_FAULT)
    33 – testMol2ToMol (OTHER_FAULT)
    35 – testReaction (OTHER_FAULT)
    36 – pyChemReactions (Failed)
    37 – testChemTransforms (OTHER_FAULT)
    40 – testFragCatalog (OTHER_FAULT)
    41 – pyFragCatalog (Failed)
    42 – testDescriptors (OTHER_FAULT)
    43 – pyMolDescriptors (Failed)
    44 – testFingerprints (OTHER_FAULT)
    45 – pyPartialCharges (Failed)
    46 – testMolTransforms (OTHER_FAULT)
    47 – pyMolTransforms (Failed)
    48 – testMMFFForceFieldHelpers (OTHER_FAULT)
    49 – testUFFForceFieldHelpers (OTHER_FAULT)
    50 – pyForceFieldHelpers (Failed)
    51 – testDistGeomHelpers (OTHER_FAULT)
    52 – pyDistGeom (Failed)
    53 – testMolAlign (OTHER_FAULT)
    54 – pyMolAlign (Failed)
    55 – testFeatures (OTHER_FAULT)
    56 – pyChemicalFeatures (Failed)
    57 – testShapeHelpers (OTHER_FAULT)
    58 – pyShapeHelpers (Failed)
    60 – pyMolCatalog (Failed)
    62 – pySLNParse (Failed)
    63 – pyGraphMolWrap (Failed)
    64 – pyTestConformerWrap (Failed)
    67 – pyMatCalc (Failed)
    68 – pyCMIM (Failed)
    69 – pyRanker (Failed)
    71 – pyFeatures (Failed)
    72 – pythonTestDbCLI (Failed)
    73 – pythonTestDirML (Failed)
    78 – pythonTestDirChem (Failed)
    Errors while running CTest

  2. JP

    Can you “echo $RDBASE” and make sure it is pointing in the right place? Also echo $PYTHONPATH
    Also, running ctest with the -V (verbose) option might shed a little bit more light on the issue.

  3. Tjelvar

    Thanks JP!

    Just installed RDKit to work with a Python virutalenv using a slightly modified version of your protocol above.

    1. Create a virtualenv
    $ virtualenv –no-site-packages env

    2. Create a local opt directory
    $ mkdir opt

    3. Modify the virtualenv activate script (instead of the .bashrc)
    $ vim env/bin/activate

    export RDBASE=/path/to/local/opt/RDKit_20XX_XX_X
    export LD_LIBRARY_PATH=$RDBASE/lib:$LD_LIBRARY_PATH
    export PYTHONPATH=$RDBASE:$PYTHONPATH

    4. Source the activate script
    $ . ./env/bin/activate

    5. Install numpy
    (env)$ easy_install numpy

    6. Untar latest RDKit download in the local opt directory and install using your excellent instructions above

    Cheers,

    Tjelvar

  4. Vytas

    86% tests passed, 12 tests failed out of 83

    Total Test time (real) = 106.47 sec

    The following tests FAILED:
    Cannot create directory /opt/rdkit-Release_2014_09_2/build/Testing/Temporary
    Cannot create log file: LastTestsFailed.log
    14 – testMMFFForceField (OTHER_FAULT)
    26 – testDepictor (OTHER_FAULT)
    31 – testMolSupplier (OTHER_FAULT)
    32 – testMolWriter (OTHER_FAULT)
    48 – testMolTransforms (OTHER_FAULT)
    51 – testUFFForceFieldHelpers (OTHER_FAULT)
    53 – testDistGeomHelpers (OTHER_FAULT)
    56 – pyMolAlign (Failed)
    65 – FMCStest (SEGFAULT)
    68 – pyGraphMolWrap (Failed)
    77 – pythonTestDbCLI (Failed)
    78 – pythonTestDirML (Failed)

    On Ubuntu 14.04.1 64bit

  5. Anke

    Hi,
    Thanks a lot for this instuction! It saved hours of trial and error!

    @Vytas: Try changing the rights, this worked fine for me:
    chmod -R a=rwx rdkit_release_2014_09_2

    Good luck!

  6. Pingback: Tanimoto Molecular Similarity Experiment – Clounce.com

Comments are closed.