Looking at the error message it looks like you could solve the problem by 
installing Swig. However, there might be easier ways to do it. It looks like 
you installed OpenBabel through Homebrew on a Mac, is that right? If so, did 
you specify "--with-python", that is run the command as "brew install 
open-babel --with-python"?
I think that would be the best way to install the python library on your system.
You can also try "conda install openbabel" to use OpenBabel in the Anaconda 
python distribution.

Kind regards,
Fredrik

On 9 mars 2017 16:01 +0100, Quim Aguirre <quim.agui...@gmail.com>, wrote:
> Thank you David!
>
> I have also tried installing openbabel, but I get the following error:
>
> $> pip install openbabel
>
> Collecting openbabel
> Downloading openbabel-2.4.1.tar.gz (74kB)
> 100% |████████████████████████████████| 81kB 1.1MB/s
> Installing collected packages: openbabel
> Running setup.py install for openbabel ... error
> Complete output from command /usr/bin/python -u -c "import setuptools, 
> tokenize;__file__='/private/tmp/pip-build-7qwutX/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-q5ZfA0-record/install-record.txt --single-version-externally-managed 
> --compile:
> running install
> running build_ext
> Open Babel location automatically determined by pkg-config:
> - include_dirs: 
> ['/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7',
>  '/usr/local/Cellar/open-babel/2.4.0/include/openbabel-2.0']
> - library_dirs: ['/usr/local/Cellar/open-babel/2.4.0/lib']
> building '_openbabel' extension
> swigging openbabel-python.i to openbabel-python_wrap.cpp
> swig -python -c++ -small -O -templatereduce -naturalvar 
> -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 
> -I/usr/local/Cellar/open-babel/2.4.0/include/openbabel-2.0 -o 
> openbabel-python_wrap.cpp openbabel-python.i
> unable to execute 'swig': No such file or directory
>
> 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
>
> ----------------------------------------
>
> Do you know why is this error occurring?
>
> Thank you very much for your help,
>
> Quim
>
> 2017-03-09 15:29 GMT+01:00 David Hall <li...@cowsandmilk.net 
> (mailto:li...@cowsandmilk.net)>:
> > Quoting from Matt Swain a couple weeks ago:
> >
> > > pip install pybel is not correct. That's an unrelated package 
> > > (https://pypi.python.org/pypi/PyBEL). Instead, do pip install openbabel
> >
> >
> > -David
> >
> > On Mar 9, 2017, at 8:29 AM, Quim Aguirre <quim.agui...@gmail.com 
> > (mailto:quim.agui...@gmail.com)> wrote:
> >
> > > Hello,
> > >
> > > I am new at using Open Babel software. My intention is to use "Pybel" to 
> > > calculate structural similarity.
> > >
> > > First, I have installed Pybel for Python 3 this way:
> > >
> > > $> pip3 install pybel
> > >
> > > However, I cannot use the function "readstring":
> > >
> > > $> python3
> > > >>> import pybel
> > > >>> smiles = ['CCCC', 'CCCN']
> > > >>> mols = [pybel.readstring("smi", x) for x in smiles] # Create a list 
> > > >>> of two molecules
> > > Traceback (most recent call last):
> > > File "<stdin>", line 1, in <module>
> > > File "<stdin>", line 1, in <listcomp>
> > > AttributeError: module 'pybel' has no attribute 'readstring'
> > >
> > > Do you know why is this happening?
> > >
> > > The other problem is that I am interested in using Pybel in Python 2.7. 
> > > However, I cannot successfully run it. I install it properly this way:
> > >
> > > $> pip install pybel
> > >
> > > But then, when importing it, I get the following error:
> > >
> > > $> python
> > > >>> import pybel
> > > Traceback (most recent call last):
> > > File "<stdin>", line 1, in <module>
> > > File "/Library/Python/2.7/site-packages/pybel/__init__.py", line 54, in 
> > > <module>
> > > from . import io
> > > File "/Library/Python/2.7/site-packages/pybel/io.py", line 31, in <module>
> > > from .canonicalize import decanonicalize_node
> > > File "/Library/Python/2.7/site-packages/pybel/canonicalize.py", line 9, 
> > > in <module>
> > > from .parser.language import rev_abundance_labels
> > > File "/Library/Python/2.7/site-packages/pybel/parser/__init__.py", line 
> > > 8, in <module>
> > > from .parse_bel import BelParser
> > > File "/Library/Python/2.7/site-packages/pybel/parser/parse_bel.py", line 
> > > 15, in <module>
> > > from .baseparser import BaseParser, WCW, nest, one_of_tags, triple
> > > File "/Library/Python/2.7/site-packages/pybel/parser/baseparser.py", line 
> > > 22, in <module>
> > > quote = dblQuotedString().setParseAction(removeQuotes)
> > > TypeError: __call__() takes exactly 2 arguments (1 given)
> > >
> > > Do you know what could be the reason of these errors? It would be very 
> > > interesting for me to be able to use this package.
> > >
> > > Thank you very much,
> > >
> > > Quim
> > >
> > > --
> > > Joaquim Aguirre Plans
> > > Researcher in the Structural Bioinformatics Laboratory (DCEXS-UPF)
> > > Student of the MSc Bioinformatics for Health Sciences (UPF/UB)
> > > Graduate in Biotechnology (UAB), specialization in Biotechnology of 
> > > Processes
> > > [Tel.] +34 692 352 112 (tel:+34%20692%2035%2021%2012)
> > > quim.agui...@gmail.com (mailto:quim.agui...@gmail.com)
> > > joaquim.agui...@upf.edu (mailto:joaquim.agui...@upf.edu)
> > > ------------------------------------------------------------------------------
> > > Announcing the Oxford Dictionaries API! The API offers world-renowned
> > > dictionary content that is easy and intuitive to access. Sign up for an
> > > account today to start using our lexical data to power your apps and
> > > projects. Get started today and enter our developer competition.
> > > http://sdm.link/oxford
> > > _______________________________________________
> > > OpenBabel-discuss mailing list
> > > OpenBabel-discuss@lists.sourceforge.net 
> > > (mailto:OpenBabel-discuss@lists.sourceforge.net)
> > > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>
>
> --
> Joaquim Aguirre Plans
> Researcher in the Structural Bioinformatics Laboratory (DCEXS-UPF)
> Student of the MSc Bioinformatics for Health Sciences (UPF/UB)
> Graduate in Biotechnology (UAB), specialization in Biotechnology of Processes
> [Tel.] +34 692 352 112 (tel:+34%20692%20352%20112)
> quim.agui...@gmail.com (mailto:quim.agui...@gmail.com)
> joaquim.agui...@upf.edu (mailto:joaquim.agui...@upf.edu)
> ------------------------------------------------------------------------------
> Announcing the Oxford Dictionaries API! The API offers world-renowned
> dictionary content that is easy and intuitive to access. Sign up for an
> account today to start using our lexical data to power your apps and
> projects. Get started today and enter our developer competition.
> http://sdm.link/oxford
> _______________________________________________
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to