I'm working on a web app django, when I install openbabel and try to import pybel i've got an error
I'm using a venv that was activate when I did all this commands
I install openbabel like this:
sudo apt-get install python-openbabel
I also tried :
sudo apt-get install openbabel libopenbabel-dev swig
Then I did :
pip install openbabel
after that, I've tried to import pybel (after importing openbabel)
This is actuall result :
>>> import pybel
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/etudiant/QuChemPedIA/QuChemPedIAProject/venv/lib/python3.5/site-packages/pybel.py", line 94, in <module>
descs = _getpluginnames("descriptors")
File "/home/etudiant/QuChemPedIA/QuChemPedIAProject/venv/lib/python3.5/site-packages/pybel.py", line 84, in _getpluginnames
return [x.split()[0] for x in plugins]
File "/home/etudiant/QuChemPedIA/QuChemPedIAProject/venv/lib/python3.5/site-packages/pybel.py", line 84, in <listcomp>
return [x.split()[0] for x in plugins]
IndexError: list index out of range
Any help please?
As @Manu mathew said, this is a bug, but not in Python's
openbabelpackage but rather in theopenbabelC library that it wraps (provided by theopenbabelapt package).The bug is fixed in version
openbabel/2.3.2+dfsg-3that for your Ubuntu Xenial (judging by your Python version) is not available.So you need to upgrade your distro. The fix is available since Bionic but for best results, upgrade to the latest distro release (see below for explanation).
Beside that,
python-openbabelapt package is useless because it's for Python 2. A package for Python 3 would be called "python3-openbabel" but there's no such package. So you do have to install the bindings from PyPI.apt-getand into venv withpipis redundant.apt-getversion of a Python package that wraps a local C library if one is available if you are using the system Python. You can make globally installed packages available in a venv by creating it with--system-site-packages.But since in this case, there's no
apt-getversion of bindings available, you have to install the bindings from PyPI. In this case, you'd better have the C library version that corresponds to the bindings' version -- i.e. probably the latest -- since that combination was clearly extensively tested.