简体   繁体   中英

rdkit installation issues with Anaconda

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!

I had the same problem, but

conda install -c conda-forge rdkit

worked out with ease.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM