how do I install a specific version of the rdkit library for Python2?

Question:

I need to install a version of the rdkit library released prior to 2019, when support for Python 2 was removed. This is needed to work with this library: https://github.com/brain-research/deep-molecular-massspec

I have downloaded the library from the git page, eg. https://github.com/rdkit/rdkit/releases/tag/Release_2018_09_1, and tried using pip to install from that.

sudo pip install rdkit-Release_2018_09_1b1.tar.gz

I get the following error:

Processing ./rdkit-Release_2018_09_1b1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File “”, line 1, in
IOError: [Errno 2] No such file or directory: ‘/tmp/pip-ohIcaj-build/setup.py’

---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-ohIcaj-build

I have tried installing the specific version using pip too:

sudo pip install rdkit==2018.09.01

Which gives:

Collecting rdkit==2018.09.01 Could not find a version that satisfies
the requirement rdkit==2018.09.01 (from versions: ) No matching
distribution found for rdkit==2018.09.01

Can someone tell me how to do this?

Asked By: Ninja Chris

||

Answers:

The problem is what you downloaded, according to that site, is a tar archive containing the source code for that library, not a pip package.

So attempting to install it using pip will not work.

The RDKit project home page gives other options for installing 1) from within an Anaconda conda virtual environment 2) from the source code (what you downloaded) for Windows, Linux, and Mac.

Those instructions are at RDKit installation instructions

Answered By: paisanco

@paisanco is correct, attempting to install rdkit with pip will not work. The easiest way to install rdkit is by using Anaconda unless you want to build from source.

If you have Anaconda installed you can create a python 2.7 virtual environment:

conda create --name test-env python=2.7

You can then activate it:

conda activate test-env

And then install the rdkit version you require:

conda install -c rdkit rdkit=2018.09.1

Using Python:

import rdkit
print rdkit.__version__
[Out]: '2018.09.1'
Answered By: Oliver Scott
conda create -n my_env python=3.7
conda activate my_env
conda install numpy matplotlib 
conda install cmake cairo pillow eigen pkg-config
conda install boost-cpp boost py-boost

and download rdkit package https://anaconda.org/rdkit/rdkit/files

# finally
conda install rdkit-2020.09.1b1.0-py37hd50e099_1.tar.bz2 
Answered By: sailfish009

Create a new conda environment with python 2.7.15:

conda create -n py27_rdkit python=2.7.15 ipython

Activate environment (python2.7)

conda activate py27_rdkit

Now in the py27_protac environment, install older version of rdkit that won’t gripe about python2.7:

conda install -c conda-forge rdkit rdkit=2018.09.1

The conda install command in answer above: ‘conda install -c rdkit rdkit=2018.09.1’ failed due numerous conflicts.

Answered By: xspensiv

I managed to get mine down using what Oliver Scott, xspensiv and sailfish009 advised plus a little from here Conda activate not working?

conda create --name test-env python=2.7


conda activate test-env

gave error:
CommandNotFoundError: Your shell has not been properly configured to use ‘conda activate’

I added C:pathtoAnaconda3Scripts to path
and ran

activate test-env

then downloaded rdkit from anaconda here https://anaconda.org/rdkit/rdkit/files?version=2018.09.1.0

and ran

(test-env) C:Windowssystem32>conda install "C:pathtoDownloadsrdkit-2018.09.1.0-py36hc0590b6_1.tar.bz2"

Downloading and Extracting Packages ##### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
Retrieving notices: ...working... done

(test-env) C:Windowssystem32>
Answered By: Nats
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.