无法安装OpenBabel包

问题描述 投票:0回答:4

我正在构建一个 python 脚本,用于测试我们的 ML 模型生成的蛋白质-配体对的结合亲和力作为正/负结合注释。执行此操作的步骤之一需要从 PubChem 下载 .SDF 文件,并且为了准备它们进行自动对接,需要将它们转换为 .PDB 文件。我找到的唯一真正的解决方案是使用 OpenBabel 来转换文件类型,但我完全无法在我的计算机上安装该软件包。无论我是否下载了最新的软件包,每次我输入

pip install openbabel
时,我都会收到以下错误消息:

Installing collected packages: openbabel
  Running setup.py install for openbabel ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\chris\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\chris\\AppData\\Local\\Temp\\pip-install-pnt2eol5\\openbabel\\setup.py'"'"'; __file__='"'"'C:\\Users\\chris\\AppData\\Local\\Temp\\pip-install-pnt2eol5\\openbabel\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\chris\AppData\Local\Temp\pip-record-enmjb591\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\chris\AppData\Local\Temp\pip-install-pnt2eol5\openbabel\
    Complete output (14 lines):
    running install
    running build_ext
    Warning: invalid version number '3.1.1.1'.
    Guessing Open Babel location:
    - include_dirs: ['c:\\users\\chris\\appdata\\local\\programs\\python\\python38\\include', 'c:\\users\\chris\\appdata\\local\\programs\\python\\python38\\include', '/usr/local/include/openbabel3']
    - library_dirs: ['c:\\users\\chris\\appdata\\local\\programs\\python\\python38\\libs', 'c:\\users\\chris\\appdata\\local\\programs\\python\\python38\\PCbuild\\amd64', '/usr/local/lib']
    building 'openbabel._openbabel' extension
    swigging openbabel\openbabel-python.i to openbabel\openbabel-python_wrap.cpp
    swig.exe -python -c++ -small -O -templatereduce -naturalvar -Ic:\users\chris\appdata\local\programs\python\python38\include -Ic:\users\chris\appdata\local\programs\python\python38\include -I/usr/local/include/openbabel3 -o openbabel\openbabel-python_wrap.cpp openbabel\openbabel-python.i

    Error: SWIG failed. Is Open Babel installed?
    You may need to manually specify the location of Open Babel include and library directories. For example:
      python setup.py build_ext -I/usr/local/include/openbabel3 -L/usr/local/lib
      python setup.py install
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\chris\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\chris\\AppData\\Local\\Temp\\pip-install-pnt2eol5\\openbabel\\setup.py'"'"'; __file__='"'"'C:\\Users\\chris\\AppData\\Local\\Temp\\pip-install-pnt2eol5\\openbabel\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\chris\AppData\Local\Temp\pip-record-enmjb591\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

我尝试自己编译该程序,并使用 conda 安装该程序,但仍然收到类似的错误。

python pip package
4个回答
0
投票

首先,确保您已经安装了 OpenBabel 软件,然后从 Windows Binaries for Python Extension Packages

下载轮子


0
投票

好吧,问题是因为 pypi, openbabel==3.1.1.1 是为 win 构建的,这是一个错误的轮子,尝试 pip install openbabel-wheel,它可能会工作,至少对我有用


-2
投票

我还没有找到此问题的确切解决方案,但尝试访问 url https://files.pythonhosted.org/packages.

如果您无法(这就是我的情况),则很可能是网络错误。

我更改了网络,并且能够继续在终端上使用 pip install 命令。


-3
投票

尝试使用命令

pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org [包名称]。请注意以管理员身份运行此命令,或者如果您使用的是 mac 系统,请在其前面添加 sudo 命令

© www.soinside.com 2019 - 2024. All rights reserved.