[cctbxbb] Boost Import Error

Gabor Bunkoczi gb360 at cam.ac.uk
Wed Jun 4 05:36:45 PDT 2014


Hi Magnus,

I think the problem is that it is picking up libboost_python.dylib that 
was supplied with the system (in /usr/local/lib), and not the one that 
was used in compilation (in $LIBTBX_BUILD/lib). Could you check that 
there is a libboost_python.dylib in this directory? What happens if you 
change the search order for the linker (if this was Linux, export 
DYLIB_LIBRARY_PATH=$LIBTBX_BUILD/lib:$DYLIB_LIBRARY_PATH would work, but 
on the Mac I do not know).

It would probably be easier for you to rebuild the cctbx Python bindings 
with the Python you want to use, and then all things would work. It only 
takes 10-20 minutes to compile even on a vintage computer.

BW, Gabor

On 2014-06-04 13:15, Magnus Andersson wrote:
> Thanks Luc,
> 
> I have now updated by PYTHONPATH as you suggested:
> 
> export
> PYTHONPATH=/Users/magnus/Downloads/cctbx_sources:/opt/local/bin:/Users/magnus/Downloads/cctbx_build/lib:/Users/magnus/Downloads/cctbx_sources:/Users/magnus/Downloads/cctbx_sources/boost_adaptbx:/Users/magnus/Downloads/cctbx_sources/libtbx/pythonpath:/usr/local/lib
> 
> , which indeed makes my /opt/local/bin/python2.7 find boost. However,
> now I get a new error message, which is a little harder to interpret:
> 
>  import iotbx.pdb
>  File "/Users/magnus/Downloads/cctbx_sources/iotbx/pdb/__init__.py",
> line 2, in <module>
>  from cctbx.array_family import flex
>  File
> "/Users/magnus/Downloads/cctbx_sources/cctbx/array_family/flex.py",
> line 2, in <module>
>  import scitbx.array_family.flex
>  File
> "/Users/magnus/Downloads/cctbx_sources/scitbx/array_family/flex.py",
> line 2, in <module>
>  import boost.optional # import dependency
>  File
> "/Users/magnus/Downloads/cctbx_sources/boost_adaptbx/boost/optional.py",
> line 2, in <module>
>  import boost.python
>  File
> "/Users/magnus/Downloads/cctbx_sources/boost_adaptbx/boost/python.py",
> line 57, in <module>
>  ext = import_ext("boost_python_meta_ext")
>  File
> "/Users/magnus/Downloads/cctbx_sources/boost_adaptbx/boost/python.py",
> line 36, in import_ext
>  + [" "+p for p in sys.path]))
> ImportError: __import__("boost_python_meta_ext"):
> dlopen(/Users/magnus/Downloads/cctbx_build/lib/boost_python_meta_ext.so,
> 2): Symbol not found:
> boost::python::objects::function_object(boost::python::objects::py_function
> const&, std::__1::pair<boost::python::detail::keyword const*,
> boost::python::detail::keyword const*> const&)
>  Referenced from:
> /Users/magnus/Downloads/cctbx_build/lib/boost_python_meta_ext.so
>  Expected in: /usr/local/lib/libboost_python.dylib
>  in /Users/magnus/Downloads/cctbx_build/lib/boost_python_meta_ext.so
>  sys.path:
> 
>  /Users/magnus/Documents/TR-WAXS/magnus_testing/PyWAXS
>  /Users/magnus/.venvburrito/lib/python/distribute-0.6.32-py2.7.egg
>  /Users/magnus/.venvburrito/lib/python/virtualenv-1.8.4-py2.7.egg
>  /Users/magnus/.venvburrito/lib/python/virtualenvwrapper-3.6-py2.7.egg
>  /Users/magnus/.venvburrito/lib/python/stevedore-0.8-py2.7.egg
>  /Users/magnus/.venvburrito/lib/python/virtualenv_clone-0.2.4-py2.7.egg
>  /Users/magnus/.venvburrito/lib/python
>  /Users/magnus/Downloads/cctbx_sources
>  /opt/local/bin
>  /Users/magnus/Downloads/cctbx_build/lib
>  /Users/magnus/Downloads/cctbx_sources/boost_adaptbx
>  /Users/magnus/Downloads/cctbx_sources/libtbx/pythonpath
>  /usr/local/lib
>  
> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip
>  
> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
> 
> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
> 
> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
> 
> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
> 
> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
> 
> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old
> 
> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/readline
> 
> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
> 
> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
> 
> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyObjC
>  /Library/Python/2.7/site-packages
> 
> I don't know how to deal with this - any suggestions?
> 
> Thanks,
> 
> Magnus
> 
> On 03 Jun 2014, at 23:44, Luc Bourhis <luc_j_bourhis at mac.com> wrote:
> 
>>> Suggestions?
>> 
>> If you want to do it by hand, you need to parrot what cctbx.python
>> does. You need to set the following environment variables:
>> 
>> 1. LIBTBX_BUILD
>> that must be the path of cctbx_build next to cctbx_sources or
>> cctbx_project
>> 
>> 2. PYTHONPATH
>> at the very least it shall contain
>> 
> $LIBTBX_BUILD/lib:$CCTBXSRC:$CCTBXSRC/boost_adaptbx:$CCTBXSRC/libtbx/pythonpath
>> 
>> where $CCTBXSRC is the full path of cctbx_sources or cctbx_project
>> 
>> 3. DYLD_LIBRARY_PATH
>> It shall contain $LIBTBX_BUILD/lib
>> 
>> Best wishes,
>> 
>> Luc
>> 
>> _______________________________________________
>> cctbxbb mailing list
>> cctbxbb at phenix-online.org
>> http://phenix-online.org/mailman/listinfo/cctbxbb
> 
> 
> _______________________________________________
> cctbxbb mailing list
> cctbxbb at phenix-online.org
> http://phenix-online.org/mailman/listinfo/cctbxbb




More information about the cctbxbb mailing list