【问题标题】:How to install the latest python module via pip?如何通过 pip 安装最新的 python 模块?
【发布时间】:2020-03-03 05:11:05
【问题描述】:

我可以看到带有pip3 search 的openbabel 3.0.0。但是当我用pip3 install 安装它时,我只得到2.4.1。有什么问题吗?如何安装最新版本?谢谢。

当我尝试指定版本时,pip 找不到它。这很奇怪,因为 pypi 上的版本是 3.0.0。 https://pypi.org/project/openbabel/

$ pip3 install openbabel==3.0.0
ERROR: Could not find a version that satisfies the requirement openbabel==3.0.0 (from versions: 1.8, 1.8.1, 1.8.2, 1.8.4, 2.4.0, 2.4.1)
ERROR: No matching distribution found for openbabel==3.0.0
$ pip3 search openbabel
openbabel (3.0.0)  - openbabel: Python interface to the Open Babel chemistry library
pyOBabel (0.1.1)   - A python binding to openbabel chemical toolbox (http://openbabel.org)
$ pip3 install openbabel
Collecting openbabel
  Using cached https://files.pythonhosted.org/packages/9c/30/eb9c3d3d3b86981f6c6a7b8eceb6f4a13b9a12673efbc842b7cebe0ce39a/openbabel-2.4.1.tar.gz
Installing collected packages: openbabel
    Running setup.py install for openbabel ... error
    ERROR: Command errored out with exit status 1:
     command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/mktemp/pip-install-6d4dkzh2/openbabel/setup.py'"'"'; __file__='"'"'/private/tmp/mktemp/pip-install-6d4dkzh2/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 /private/tmp/mktemp/pip-record-xr3vrvho/install-record.txt --single-version-externally-managed --compile
         cwd: /private/tmp/mktemp/pip-install-6d4dkzh2/openbabel/
    Complete output (64 lines):
    running install
    running build_ext
    Warning: package openbabel-2.0 could not be found by pkg-config.
    Guessing Open Babel location:
    - include_dirs: ['/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8m', '/usr/local/include/openbabel-2.0']
    - library_dirs: ['/usr/local/lib']
    building '_openbabel' extension
    swigging openbabel-python.i to openbabel-python_wrap.cpp
    swig -python -c++ -small -O -templatereduce -naturalvar -I/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8m -I/usr/local/include/openbabel-2.0 -o openbabel-python_wrap.cpp openbabel-python.i
    openbabel-python.i:225: Error: Unable to find 'openbabel/babelconfig.h'
    openbabel-python.i:227: Error: Unable to find 'openbabel/data.h'
    openbabel-python.i:228: Error: Unable to find 'openbabel/rand.h'
    openbabel-python.i:229: Error: Unable to find 'openbabel/obutil.h'
    openbabel-python.i:230: Error: Unable to find 'openbabel/math/vector3.h'
    openbabel-python.i:232: Error: Unable to find 'openbabel/math/matrix3x3.h'
    openbabel-python.i:233: Error: Unable to find 'openbabel/math/transform3d.h'
    openbabel-python.i:234: Error: Unable to find 'openbabel/math/spacegroup.h'
    openbabel-python.i:238: Error: Unable to find 'openbabel/base.h'
    openbabel-python.i:240: Error: Unable to find 'openbabel/generic.h'
    openbabel-python.i:241: Error: Unable to find 'openbabel/griddata.h'
    openbabel-python.i:243: Error: Unable to find 'openbabel/chains.h'
    openbabel-python.i:244: Error: Unable to find 'openbabel/typer.h'
    openbabel-python.i:252: Error: Unable to find 'openbabel/plugin.h'
    openbabel-python.i:257: Error: Unable to find 'openbabel/oberror.h'
    openbabel-python.i:258: Error: Unable to find 'openbabel/format.h'
    openbabel-python.i:259: Error: Unable to find 'openbabel/obconversion.h'
    openbabel-python.i:260: Error: Unable to find 'openbabel/residue.h'
    openbabel-python.i:261: Error: Unable to find 'openbabel/internalcoord.h'
    openbabel-python.i:262: Error: Unable to find 'openbabel/atom.h'
    openbabel-python.i:263: Error: Unable to find 'openbabel/bond.h'
    openbabel-python.i:264: Error: Unable to find 'openbabel/reaction.h'
    openbabel-python.i:282: Error: Unable to find 'openbabel/mol.h'
    openbabel-python.i:289: Error: Unable to find 'openbabel/ring.h'
    openbabel-python.i:290: Error: Unable to find 'openbabel/parsmart.h'
    openbabel-python.i:291: Error: Unable to find 'openbabel/alias.h'
    openbabel-python.i:292: Error: Unable to find 'openbabel/atomclass.h'
    openbabel-python.i:294: Error: Unable to find 'openbabel/fingerprint.h'
    openbabel-python.i:296: Error: Unable to find 'openbabel/descriptor.h'
    openbabel-python.i:301: Error: Unable to find 'openbabel/forcefield.h'
    openbabel-python.i:303: Error: Unable to find 'openbabel/builder.h'
    openbabel-python.i:304: Error: Unable to find 'openbabel/op.h'
    openbabel-python.i:306: Error: Unable to find 'openbabel/chargemodel.h'
    openbabel-python.i:309: Error: Unable to find 'openbabel/phmodel.h'
    openbabel-python.i:310: Error: Unable to find 'openbabel/graphsym.h'
    openbabel-python.i:311: Error: Unable to find 'openbabel/isomorphism.h'
    openbabel-python.i:312: Error: Unable to find 'openbabel/query.h'
    openbabel-python.i:313: Error: Unable to find 'openbabel/canon.h'
    openbabel-python.i:315: Error: Unable to find 'openbabel/stereo/stereo.h'
    openbabel-python.i:318: Error: Unable to find 'openbabel/bitvec.h'
    openbabel-python.i:321: Error: Unable to find 'openbabel/rotor.h'
    openbabel-python.i:323: Error: Unable to find 'openbabel/rotamer.h'
    openbabel-python.i:324: Error: Unable to find 'openbabel/spectrophore.h'
    openbabel-python.i:374: Error: Unable to find 'openbabel/obiter.h'
    stereo.i:1: Error: Unable to find 'openbabel/stereo/tetranonplanar.h'
    stereo.i:2: Error: Unable to find 'openbabel/stereo/tetraplanar.h'
    stereo.i:3: Error: Unable to find 'openbabel/stereo/tetrahedral.h'
    stereo.i:4: Error: Unable to find 'openbabel/stereo/cistrans.h'
    stereo.i:5: Error: Unable to find 'openbabel/stereo/squareplanar.h'
    stereo.i:6: Error: Unable to find 'openbabel/stereo/bindings.h'

    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/openbabel-2.0 -L/usr/local/lib
      python setup.py install
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/mktemp/pip-install-6d4dkzh2/openbabel/setup.py'"'"'; __file__='"'"'/private/tmp/mktemp/pip-install-6d4dkzh2/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 /private/tmp/mktemp/pip-record-xr3vrvho/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

open-babel 3.0.0 由 homebrew 安装。

$ brew info open-babel
open-babel: stable 3.0.0 (bottled), HEAD
Chemical toolbox
https://openbabel.org
/usr/local/Cellar/open-babel/3.0.0 (328 files, 19.5MB) *
  Poured from bottle on 2019-11-02 at 02:42:41
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/open-babel.rb
==> Dependencies
Build: cmake ✘, pkg-config ✔, rapidjson ✘, swig ✔
Required: cairo ✔, eigen ✔, python ✘
==> Options
--HEAD
    Install HEAD version
``

【问题讨论】:

  • 错误消息似乎很容易解释。您需要什么帮助?
  • 我不熟悉那个包,但看起来你需要在你的系统上安装 Open Babel 库,然后然后你可以在它周围安装 Python 包装器.根据您的操作系统,您可能需要安装一个名为 libopenbabel-dev 或类似名称的软件包。
  • 我已经安装了,但是 3.0.0.问题是我的 pip 没有安装最新的 python 版本。 $ brew info open-babel open-babel: stable 3.0.0 (bottled), HEAD Chemical toolbox https://openbabel.org /usr/local/Cellar/open-babel/3.0.0 (328 files, 19.5MB) * Poured from bottle on 2019-11-02 at 02:42:41 From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/open-babel.rb ==> Dependencies Build: cmake ✘, pkg-config ✔, rapidjson ✘, swig ✔ Required: cairo ✔, eigen ✔, python ✘ ==> Options --HEAD Install HEAD version

标签: python pip openbabel


【解决方案1】:

从表面上看,openbabel 的维护者并没有为您的系统发布任何可用的项目发行版。您似乎在使用 Linux,但只有为 Windows 预先构建的 wheels,并且没有源代码分发 (sdist):

您可以降级到较早的版本,或直接从他们的源代码存储库安装,如下所示:

pip install 'git+https://github.com/openbabel/openbabel.git@openbabel-3-0-0#egg=openbabel&subdirectory=scripts/python'

注意:遗憾的是,这实际上不起作用,因为某些文件似乎需要事先进行预处理步骤。还有一些alternative installation instructions on this document

您最好的选择仍然是要求维护人员在 PyPI 上发布 sdist 或 Linux-wheels

相关问题:https://github.com/openbabel/openbabel/issues/2067

【讨论】:

猜你喜欢
  • 2017-10-16
  • 1970-01-01
  • 1970-01-01
  • 2017-03-23
  • 1970-01-01
  • 2017-09-23
  • 1970-01-01
  • 2015-09-25
  • 1970-01-01
相关资源
最近更新 更多