When import dlib:
import dlib
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/dlib-19.7.99-py3.6-macosx-10.6-intel.egg/dlib/__init__.py", line 1, in <module>
from .dlib import *
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/dlib-19.7.99-py3.6-macosx-10.6-intel.egg/dlib/dlib.so, 2): Symbol not found: _PyClass_Type
Referenced from: /usr/local/opt/boost-python/lib/libboost_python-mt.dylib
Expected in: flat namespace
in /usr/local/opt/boost-python/lib/libboost_python-mt.dylib
Any help?
Yes, I have more than one copy of Python installed on my Mac and they are
I pip3 install dlib for python3.6. So, how should I complie Boost and dlib against python 3.6?
Run dlib's setup.py script with the python you want to use. As for boost,
I don't know. I would refer to the boost documentation for instructions in
your case.
I brew install boost-python --with-python3 and run python3 setup.py install --yes USE_AVX_INSTRUCTIONS. But same error when import dlib. I think I should try some other way of installing boost-python.
stackoverflow solution to correct boost-python error.
brew uninstall boost-python brew install boost-python --with-python3libboost_python3 to libboost_pythoncd /usr/local/opt/boost-python/lib/ls, and got something like this: libboost_python-mt.a libboost_python3-mt.a
libboost_python-mt.dylib libboost_python3-mt.dylib
libboost_python.a libboost_python3.a
libboost_python.dylib libboost_python3.dylib
backup boost-python for python2 and change boost-python for python3:
mv libboost_python-mt.a libboost_python2-mt.a && cp libboost_python3-mt.a libboost_python-mt.a
mv libboost_python-mt.dylib libboost_python2-mt.dylib && cp libboost_python3-mt.dylib libboost_python-mt.dylib
mv libboost_python.a libboost_python2.a && cp libboost_python3.a libboost_python.a
mv libboost_python.dylib libboost_python2.dylib && cp libboost_python3-mt.dylib libboost_python.dylib
python3 setup.py install --yes USE_AVX_INSTRUCTIONSDone!
Sweet, thanks for reporting how to fix it :)
Thank you for the instructions! Slight typo though (needs double ampersand not single, otherwise it gets confused and tries to create daemons!)
mv libboost_python-mt.a libboost_python2-mt.a && cp libboost_python3-mt.a libboost_python-mt.a
mv libboost_python-mt.dylib libboost_python2-mt.dylib && cp libboost_python3-mt.dylib libboost_python-mt.dylib
mv libboost_python.a libboost_python2.a && cp libboost_python3.a libboost_python.a
mv libboost_python.dylib libboost_python2.dylib && cp libboost_python3-mt.dylib libboost_python.dylib
I found that using an older version of boost on macOS fixed things for me:
brew install homebrew/versions/boost155
The @Aspirinkb 's solution are not work at all. Still same error after do this.
Most helpful comment
brew uninstall boost-pythonbrew install boost-python --with-python3libboost_python3tolibboost_pythoncd /usr/local/opt/boost-python/lib/ls, and got something like this:backup boost-python for python2 and change boost-python for python3:
python3 setup.py install --yes USE_AVX_INSTRUCTIONSDone!