Ninja Chris
Ninja Chris

Reputation: 321

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

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?

Upvotes: 0

Views: 7110

Answers (4)

xspensiv
xspensiv

Reputation: 11

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.

Upvotes: 1

sailfish009
sailfish009

Reputation: 2927

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 

Upvotes: -1

Oliver Scott
Oliver Scott

Reputation: 1783

@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'

Upvotes: 4

paisanco
paisanco

Reputation: 4164

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

Upvotes: 1

Related Questions