Open Babel links against libcairo and libz. But so does your Python cairo. But I'm guessing that you didn't compile OpenBabel against the Anaconda libraries. In the world of dynamically-linked libraries, the first one to be loaded wins. If you load one that's older, it won't have the symbols needed by code that was developed for a newer library.
- Noel On 29 March 2017 at 14:46, Hongbin Yang <yanyangh...@163.com> wrote: > Hi, all, > > I wanted to use both pybel and cairo. If I import cairo first, > everything works well. If I import pybel or openbabel first, error will > happen. > > So I think there is something not good in the python wrapper in openbabel, > but I can find nothing.. > > Here is the test: > > ``` >>>> import cairo >>>> import openbabel >>>> reload(cairo) > <module 'cairo' from > '/home/yccai/Programs/Anaconda/lib/python2.7/site-packages/cairo/__init__.pyc'> >>>> cairo > <module 'cairo' from > '/home/yccai/Programs/Anaconda/lib/python2.7/site-packages/cairo/__init__.pyc'> > #### exit and reopen python #### >>>> import openbabel >>>> import cairo > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File > "/home/yccai/Programs/Anaconda/lib/python2.7/site-packages/cairo/__init__.py", > line 1, in <module> > from _cairo import * > ImportError: > /home/yccai/Programs/Anaconda/lib/python2.7/site-packages/cairo/../../.././libpng16.so.16: > symbol inflateReset2, version ZLIB_1.2.3.4 not defined in file libz.so.1 > with link time reference > #### exit and reopen python #### >>>> import pybel >>>> import cairo > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File > "/home/yccai/Programs/Anaconda/lib/python2.7/site-packages/cairo/__init__.py", > line 1, in <module> > from _cairo import * > ImportError: > /home/yccai/Programs/Anaconda/lib/python2.7/site-packages/cairo/_cairo.so: > undefined symbol: cairo_surface_get_fallback_resolution > ``` > > Environment: > python is in conda: `/home/yccai/Programs/Anaconda/` > openbabel and pybel is in : `/home/hbyang/applic/openbabel/lib`, which is > included in pythonpath so that everything is ok in using pybel or openbabel. > > PS: hbyang is my ID, and I have no permission to write in `~yccai/`. > > ________________________________ > Hongbin Yang > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > OpenBabel-discuss mailing list > OpenBabel-discuss@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss