Dear Alan,

thank you so much for your help. It all does make sense, but I am not sure how 
I could sort this out, because I intend to use autodock vina, which actually 
calls openbabel scripts... so, should I try and use Autodock Vina through 
conda? How do I do that? If that's so, shouldn't I be having problems with 
SWIG? It's all very confusing to me as I am new to this kind of tool...

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

Would you know how to execute this solution that appears when SWIG fails? I've 
tried, but maybe I did something wrong, because nothing changed...

Any help is very appreciated! Thank you!


--


Artur

________________________________
From: Alan <alanwil...@gmail.com>
Sent: Friday, December 3, 2021 05:06
To: Artur Hermano <artur.herm...@hotmail.com>
Subject: Re: [Open Babel] help with installation

It's all about in which environment you did install openbabel. In macOS for 
example, using brew, only the python shipped by brew will see the openbabel 
module, not even a virtual env from this very same python will see it. It's 
really annoying, unfortunately, because the binary "obabel" is usually 
available in any environment.

The safe solution I found so far, if I need to work with openbabel, is to use 
conda.

I've tried "openbabel-wheel"(which in principle should allow me to install it 
in a py venv) but it didn't work on my Mac.

Though I use Mac, the same logic applies to Ubuntu. Openbabel python module 
will only work with the very specific python shipped in the same distribution.

On Wed, 1 Dec 2021 at 13:43, Artur Hermano 
<artur.herm...@hotmail.com<mailto:artur.herm...@hotmail.com>> wrote:
Hello OpenBabel users,

I've been having issues with OpenBabel and thought I might use some help from 
more experienced users.
My main problem is that I have (apparently) installed OpenBabel succesfully, 
but other softwares cannot access it. For example, when I try to run a programm 
that uses OpenBabel ('mk_prepare_ligand.py -i 1iep_ligand.sdf -o 
1iep_ligand.pdbqt --pH 7.4'), I get the following error:

'Traceback (most recent call last):
  File "/home/artur/.local/bin/mk_prepare_ligand.py", line 11, in <module>
    from openbabel import openbabel as ob
ModuleNotFoundError: No module named 'openbabel''

Furthermore, if I try to remove openbabel from my system, I receive a message 
(in Portuguese, so I won't copy it here) saying that "openbabel isn't 
installed, so it won't be removed". However, I can easily execute the comand 
obabel through my Ubuntu 20.04 terminal.
Additionally, if I try the command pip install -U openbabel, I get the 
following error message:

Collecting openbabel
  Using cached openbabel-3.1.1.1.tar.gz (82 kB)
Building wheels for collected packages: openbabel
  Building wheel for openbabel (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; 
sys.argv[0] = '"'"'/tmp/pip-install-ctx5tcrx/openbabel/setup.py'"'"'; 
__file__='"'"'/tmp/pip-install-ctx5tcrx/openbabel/setup.py'"'"';f=getattr(tokenize,
 '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', 
'"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' 
bdist_wheel -d /tmp/pip-wheel-xzrzd_1p
       cwd: /tmp/pip-install-ctx5tcrx/openbabel/
  Complete output (66 lines):
  running bdist_wheel
  running build
  running build_ext
  Warning: invalid version number '3.1.1.1'.
  Guessing Open Babel location:
  - include_dirs: ['/usr/include/python3.8', '/usr/local/include/openbabel3']
  - library_dirs: ['/usr/local/lib']
  building 'openbabel._openbabel' extension
  swigging openbabel/openbabel-python.i to openbabel/openbabel-python_wrap.cpp
  swig -python -c++ -small -O -templatereduce -naturalvar 
-I/usr/include/python3.8 -I/usr/local/include/openbabel3 -o 
openbabel/openbabel-python_wrap.cpp openbabel/openbabel-python.i

then several errors similar to these: openbabel/openbabel-python.i:246: Error: 
Unable to find 'openbabel/babelconfig.h'
  openbabel/openbabel-python.i:248: Error: Unable to find 'openbabel/data.h'
  openbabel/openbabel-python.i:249: Error: Unable to find 'openbabel/obutil.h'

And then finally: 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: /usr/bin/python3 -u -c 'import 
sys, setuptools, tokenize; sys.argv[0] = 
'"'"'/tmp/pip-install-ctx5tcrx/openbabel/setup.py'"'"'; 
__file__='"'"'/tmp/pip-install-ctx5tcrx/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 /tmp/pip-record-ik_t9mkr/install-record.txt 
--single-version-externally-managed --user --prefix= --compile 
--install-headers /home/artur/.local/include/python3.8/openbabel Check the logs 
for full command output.

I have no clue as of why Swig is failing, since I have installed it perfectly. 
I don't quite understand how to execute the suggestion given after this error, 
so I don't know what to do. I tried following the instructions at 
https://open-babel.readthedocs.io/en/latest/Installation/install.html#compile-bindings,
 but maybe I did something wrong.

Would anyone be able to help me out? Any help is more than appreciated.
Thank you so much in advance!


--


Artur

_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net<mailto:OpenBabel-discuss@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


--
Alan Silva 🚲🏊‍♂🏃‍♂🇧🇷🇫🇷🇬🇧
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to