I previously had the same issue with a different error here and thought it would be appropriate to ask a separate question.
import dlib
File "/usr/local/lib/python2.7/site-packages/dlib/__init__.py", line 1, in <module>
from .dlib import *
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/dlib/dlib.so, 2): Library not loaded: /Library/Python/2.7/site-packages/dlib/dlib.so
Referenced from: /usr/local/lib/python2.7/site-packages/dlib/dlib.so
Reason: Incompatible library version: dlib.so requires version 44.0.0 or later, but dlib.so provides version 0.0.0
I am almost certain this is because after I used install_name_tool -id "@loader_path/opt/X11/lib/libpng16.16.dylib" /usr/local/lib/python2.7/site-packages/dlib/dlib.so
(which was not what resolved my previous error) otool -L /usr/local/lib/python2.7/site-packages/dlib/dlib.so
stopped returning this:
/usr/local/lib/python2.7/site-packages/dlib/dlib.so:
@rpath/dlib.so (compatibility version 0.0.0, current version 0.0.0)
/usr/local/opt/boost-python/lib/libboost_python-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
/opt/X11/lib/libSM.6.dylib (compatibility version 7.0.0, current version 7.1.0)
/opt/X11/lib/libICE.6.dylib (compatibility version 10.0.0, current version 10.0.0)
/opt/X11/lib/libX11.6.dylib (compatibility version 10.0.0, current version 10.0.0)
/opt/X11/lib/libXext.6.dylib (compatibility version 11.0.0, current version 11.0.0)
@rpath/libpng16.16.dylib (compatibility version 44.0.0, current version 44.0.0)
@rpath/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
@rpath/libmkl_rt.dylib (compatibility version 0.0.0, current version 0.0.0)
@rpath/libsqlite3.0.dylib (compatibility version 9.0.0, current version 9.6.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 307.5.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2)
and started returning this:
/usr/local/lib/python2.7/site-packages/dlib/dlib.so:
@loader_path/opt/X11/lib/libpng16.16.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/opt/boost-python/lib/libboost_python-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
/opt/X11/lib/libSM.6.dylib (compatibility version 7.0.0, current version 7.1.0)
/opt/X11/lib/libICE.6.dylib (compatibility version 10.0.0, current version 10.0.0)
/opt/X11/lib/libX11.6.dylib (compatibility version 10.0.0, current version 10.0.0)
/opt/X11/lib/libXext.6.dylib (compatibility version 11.0.0, current version 11.0.0)
@rpath/libpng16.16.dylib (compatibility version 44.0.0, current version 44.0.0)
@rpath/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
@rpath/libmkl_rt.dylib (compatibility version 0.0.0, current version 0.0.0)
@rpath/libsqlite3.0.dylib (compatibility version 9.0.0, current version 9.6.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 307.5.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2)
After 'resolving' my previous path error with install_name_tool -change @rpath/libpng16.16.dylib "/Library/Python/2.7/site-packages/dlib/dlib.so" /usr/local/lib/python2.7/site-packages/dlib/dlib.so
I got this:
/usr/local/lib/python2.7/site-packages/dlib/dlib.so:
/Library/Python/2.7/site-packages/dlib/dlib.so (compatibility version 0.0.0, current version 0.0.0)
/usr/local/opt/boost-python/lib/libboost_python-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
/opt/X11/lib/libSM.6.dylib (compatibility version 7.0.0, current version 7.1.0)
/opt/X11/lib/libICE.6.dylib (compatibility version 10.0.0, current version 10.0.0)
/opt/X11/lib/libX11.6.dylib (compatibility version 10.0.0, current version 10.0.0)
/opt/X11/lib/libXext.6.dylib (compatibility version 11.0.0, current version 11.0.0)
/Library/Python/2.7/site-packages/dlib/dlib.so (compatibility version 44.0.0, current version 44.0.0)
@rpath/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
@rpath/libmkl_rt.dylib (compatibility version 0.0.0, current version 0.0.0)
@rpath/libsqlite3.0.dylib (compatibility version 9.0.0, current version 9.6.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 307.5.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2)
I do not know what is required to make my dlib.co
path and file compatible, and if I cannot do anything about this I am willing to reinstall everything, but I do not know what I would have to do differently next time. How could I restart this process? I have tried uninstalling and reinstalling several dependencies(cmake, boost, boost-python, libpng, dlib). I have also tried restoring the paths back to what they were with: install_name_tool -id "libpng16.16.dylib" @loading_path/opt/X11/lib/libpng16.16.dylib
but I do not know how relevant that is and no longer understand what I am doing.
What can I do from here to successfully install dlib?