9

I am trying to get rdkit working on my Windows 7 system with Anaconda and Python 2.7. I have been following the instructions from http://www.rdkit.org/docs/Install.html

conda create -c https://conda.anaconda.org/rdkit -n my-rdkit-env rdkit
activate my-rdkit-env

I then get the following:

Deactivating environment "C:\Anaconda2"...

Activating environment "C:\Anaconda2\envs\my-rdkit-env"

However, if I then open a Jupyter notebook, and try to

import rdkit

It fails with

ImportError: No module named rdkit

Any help would be greatly appreciated!

Community
  • 1
  • 1
Crath
  • 91
  • 1
  • 1
  • 3
  • You either have to install jupyter in your `my-rdkit-env` environment, or install an ipython kernel in the `my-rdkit-env` environemnt, as described here: http://stackoverflow.com/questions/30492623/using-both-python-2-x-and-python-3-x-in-ipython-notebook – cel May 15 '16 at 18:45

4 Answers4

6

I had the same problem, but

conda install -c conda-forge rdkit

worked out with ease.

banan3'14
  • 3,810
  • 3
  • 24
  • 47
0

I solved the problem. please install ipykernel by conda and it should work as normal.

Sankho Roy
  • 13
  • 3
0

The problem is that you are not really using the conda environment to run the jupyter notebook. To verify this is the case, run in the terminal window and also insert in the jupyter notebook the following code:

import sys
print(sys.path)

In my case, I was running a python script and I got Terminal window

['', '/home/sputnik/.conda/envs/compchem/lib/python310.zip', '/home/sputnik/.conda/envs/compchem/lib/python3.10', '/home/sputnik/.conda/envs/compchem/lib/python3.10/lib-dynload', '/home/sputnik/.conda/envs/compchem/lib/python3.10/site-packages']

Script run ./script.py

['/home/sputnik', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/usr/local/lib/python3.8/dist-packages', '/usr/lib/python3/dist-packages']

In my case the solution was to run the script explicitly calling python

python ./script.py

In the case of a Jupyter Notebook you will need to make sure it is running in the correct environment. You can use this package to help:

pip install environment_kernels

And get more information from:

http://stuartmumford.uk/blog/jupyter-notebook-and-conda.html

Sputnik
  • 168
  • 2
  • 7
0

I tried to create a new conda environment with python 3.7.16 and import rdkit successfully. From my point of view, it is the fasted way which I do not have to wait for solving environment. You can try the commands following:

conda create -c conda-forge -n my-rdkit-env rdkit python=3.7
conda activate my-rdkit-env
python
import rdkit
M.Vu
  • 397
  • 2
  • 9