Leonardo, thanks for the suggestion.
I tried the DPYTHON_INCLUDE_DIR option shown below.
cmake ../openbabel -DPYTHON_BINDINGS=ON -DRUN_SWIG=ON
-DPYTHON_INCLUDE_DIR=~/usr/include/python2.7
make failed with the following error.
/Users/dansmith/Documents/MOLECULAR_MODELING/OpenBabel/openbabel/scripts/python/openbabel-python.cpp:174:11:
fatal error:
'Python.h' file not found
# include <Python.h>
^
1 error generated.
In the original build attempt without the DPYTHON_INCLUDE_DIR option. There
were 3 warnings at the same point shown below and several messages.
I’m not sure why my implementation of your suggestion fails as I verified that
Python.h could be found in /usr/include/python2.7; however, after closer
inspection of the “sudo make install” output I believe I have discovered part
of the problem. I tried the original installation method.
cmake ../openbabel -DPYTHON_BINDINGS=ON -DRUN_SWIG=ON
make
sudo make install
The output from “sudo make install” for openbabel.py and pybel.py is shown
below.
-- Installing: /usr/local/lib/python2.7/site-packages/_openbabel.so
-- Up-to-date: /usr/local/lib/python2.7/site-packages/openbabel.py
-— Up-to-date: /usr/local/lib/python2.7/site-packages/pybel.py
I set the python path as follows.
export PYTHONPATH=/usr/local/lib/python2.7/site-packages/:$PYTHONPATH
Importing pybel and openbabel works now. I tried to work through some of the
examples on the web
(http://openbabel.org/docs/current/UseTheLibrary/Python_Pybel.html). The
examples do not work exactly as written. For instance, I cannot use the
command “read string”, but I can use “pybel.readstring”.
>>> mymol = readstring("smi", "CCCC")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'readstring' is not defined
>>> mymol = pybel.readstring("smi", "CCCC")
>>> print mymol.molwt
58.1222
Is this normal or is there something wrong with my installation?
Thanks,
Dan
> On Jul 7, 2016, at 6:01 PM, Leonardo Lazzaro <llazz...@dc.uba.ar> wrote:
>
> Hello,
>
> try to use the options DPYTHON_INCLUDE_DIR, DCMAKE_INSTALL_PREFIX.
> for example for anaconda2 I used the following command:
>
> cmake .. -DPYTHON_BINDINGS=ON -DRUN_SWIG=ON
> -DCMAKE_INSTALL_PREFIX=~/anaconda2
> -DPYTHON_INCLUDE_DIR=~/anaconda2/include/python2.7
> -DCMAKE_LIBRARY_PATH=~/anaconda2/lib
> -DSWIG_DIR=~/anaconda2/share/swig/3.0.2/
> -DSWIG_EXECUTABLE=~/anaconda2/bin/swig
> -DPYTHON_LIBRARY=~/anaconda2/lib/libpython2.7.so
> -DCMAKE_BUILD_TYPE=DEBUG
>
> hope it helps,
> Leonardo
>
> On 2016-07-07 17:23, Dan Smith wrote:
>> Hello,
>>
>> I am using openbabel on a Mac - El Capitan OS X 10.11.5 operating
>> system.
>>
>> I have installed eigen2. I have python version 2.7.10.
>>
>> I have successfully compiled version 2.3.90 using the following
>> commands in terminal.
>>
>> cmake ../openbabel -DPYTHON_BINDINGS=ON -DRUN_SWIG=ON
>> make
>> sudo make install
>> export PYTHONPATH=/usr/local/lib:$PYTHONPATH
>>
>> When I attempt to import pybel or openbabel in Python I get the
>> following messages.
>>
>>>>> import pybel
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> ImportError: No module named pybel
>>
>>>>> import openbabel
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> ImportError: No module named openbabel
>>
>> I have tried to search previous posts but have not found an answer
>> that will solve my problem. At this point I’m not sure what to do to
>> diagnose the problem.
>>
>> Any help in solving my problem would be appreciated.
>>
>> Thanks,
>>
>> Dan
>> ------------------------------------------------------------------------------
>> Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
>> Francisco, CA to explore cutting-edge tech and listen to tech
>> luminaries
>> present their vision of the future. This family event has something for
>> everyone, including kids. Get more information and register today.
>> http://sdm.link/attshape
>> _______________________________________________
>> OpenBabel-discuss mailing list
>> OpenBabel-discuss@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
> ------------------------------------------------------------------------------
> Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
> Francisco, CA to explore cutting-edge tech and listen to tech luminaries
> present their vision of the future. This family event has something for
> everyone, including kids. Get more information and register today.
> http://sdm.link/attshape
> _______________________________________________
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss