简体   繁体   English

Anaconda 的 rdkit 安装问题

[英]rdkit installation issues with Anaconda

I am trying to get rdkit working on my Windows 7 system with Anaconda and Python 2.7.我正在尝试让 rdkit 在我的 Windows 7 系统上运行 Anaconda 和 Python 2.7。 I have been following the instructions from http://www.rdkit.org/docs/Install.html我一直在按照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"...停用环境“C:\Anaconda2”...

Activating environment "C:\Anaconda2\envs\my-rdkit-env"激活环境“C:\Anaconda2\envs\my-rdkit-env”

However, if I then open a Jupyter notebook, and try to但是,如果我随后打开一个 Jupyter notebook,并尝试

import rdkit

It fails with它失败了

ImportError: No module named rdkit导入错误:没有名为 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.请通过 conda 安装 ipykernel,它应该可以正常工作。

The problem is that you are not really using the conda environment to run the jupyter notebook.问题是你并没有真正使用 conda 环境来运行 jupyter notebook。 To verify this is the case, run in the terminal window and also insert in the jupyter notebook the following code:要验证是否是这种情况,请在终端 window 中运行,并在 jupyter notebook 中插入以下代码:

import sys
print(sys.path)

In my case, I was running a python script and I got Terminal window就我而言,我正在运行一个 python 脚本,我得到了终端 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'] ['', '/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脚本运行./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'] ['/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

python ./script.py ./script.py ./脚本.py

In the case of a Jupyter Notebook you will need to make sure it is running in the correct environment.对于 Jupyter Notebook,您需要确保它在正确的环境中运行。 You can use this package to help:您可以使用此 package 来帮助:

pip install environment_kernels

And get more information from:并从以下位置获取更多信息:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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