4

I have installed Spyder3.2.1 in the current version of Miniconda3 on my Debian v-9.1.0 64 bit Linux platform. Spyder is performing well, but I am having difficulty installing the RDKit.

I followed the directions in the RDKit_Docs_current.pdf:

How to install RDKit with Conda

Creating a new conda environment with the RDKit installed using these packages requires one single command similar to the following:

$ conda create -c rdkit -n my-rdkit-env rdkit

Finally, the new environment must be activated, so that the corresponding python interpreter becomes available in the same shell:

$ source activate my-rdkit-env

There were no warning or error messages during the installation, but when I attempt running a simple Python script:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 15 11:41:24 2017

@author: comp
"""

from __future__ import print_function
from rdkit import Chem

m = Chem.MolFromSmiles('Cc1ccccc1')
m

I get:

IPython 6.1.0 -- An enhanced Interactive Python.

runfile('/home/comp/Apps/Python/untitled0.py', 
wdir='/home/comp/Apps/Python')
Traceback (most recent call last):

File "<ipython-input-1-3842c59475d8>", line 1, in <module>
runfile('/home/comp/Apps/Python/untitled0.py', 
wdir='/home/comp/Apps/Python')

File "/home/comp/Apps/miniconda3/lib/python3.6/site-
packages/spyder/utils/site/sitecustomize.py", line 688, in runfile
execfile(filename, namespace)

File "/home/comp/Apps/miniconda3/lib/python3.6/site-
packages/spyder/utils/site/sitecustomize.py", line 101, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "/home/comp/Apps/Python/untitled0.py", line 10, in <module>
from rdkit import Chem

ModuleNotFoundError: No module named 'rdkit'

RDKit is installed in ~/miniconda3/envs/mr-rdkit-env

Unfortunately, I have no clue as to what the problem(s) may be, assistance will be much appreciated.

Thanks in advance.

Blade
  • 984
  • 3
  • 12
  • 34
Steve
  • 153
  • 2
  • 13
  • This could be a Conda issue rather than an RDKit one. Its possible that the environment that RDKit was installed into, is not the same as the one you are using to run the script. Can you try `which ipython`. If its pointing to a different environment other than `my-rdkit-env` then this is your issue. Try installing ipython to your conda env, or alternatively just use python rather than ipython – JoshuaBox Jan 31 '23 at 14:12

2 Answers2

0

If you are using PyCharm try to install RDKit package in File > Settings > Project Interpreter > + , then seach for RDkit to install and use the Python Interpreter where the RDKit is installed or you can reference your ~/miniconda3/envs/mr-rdkit-env/python.exe on your Python Interpreter

Blade
  • 984
  • 3
  • 12
  • 34
Marr
  • 555
  • 1
  • 6
  • 11
-1

switch your currrent python edition to python2.7,you can create a enviroment:conda create -n my_env_name python=2.7

markchern
  • 39
  • 4