2

I can see openbabel 3.0.0 with pip3 search. But when I install it with pip3 install, I get only 2.4.1. Is there anything wrong? How to get the latest version installed? Thanks.

When I try to specify the version, pip does not find it. This is strange given the version on pypi is 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 is installed by 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
``
user1424739
  • 11,937
  • 17
  • 63
  • 152
  • The error messages seem pretty self explanatory. What do you need help with? – sinoroc Nov 06 '19 at 16:46
  • I'm not familiar with that package, but it looks like you need to install the Open Babel library on your system, and _then_ you can install the Python wrapper around it. Depending on your OS you might need to install a package called `libopenbabel-dev` or similar. – saintamh Nov 06 '19 at 16:52
  • I have it installed, but 3.0.0. The problem is my pip does not install the lastest python version. ```$ 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 ``` – user1424739 Nov 06 '19 at 16:58

1 Answers1

1

From the looks of it, the maintainers of openbabel did not publish any usable distribution of the project for your system. You seem to be using Linux, but there are only pre-built wheels for Windows, and no source distribution (sdist):

You could downgrade to an earlier version, or install directly from their source code repository with something like the following:

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

Note: sadly this doesn't actually work, because some files seem to require a pre-process step beforehand. There are some alternative installation instructions on this document.

Your best bet, would still be to ask the maintainers to release an sdist or Linux-wheels on PyPI.

Related issue: https://github.com/openbabel/openbabel/issues/2067

sinoroc
  • 18,409
  • 2
  • 39
  • 70