I encountered the following err when use python setup.py install as well as pip install dlib
...
[ 97%] Building CXX object CMakeFiles/dlib_.dir/src/correlation_tracker.cpp.o
[ 98%] Building CXX object CMakeFiles/dlib_.dir/src/face_recognition.cpp.o
[ 99%] Building CXX object CMakeFiles/dlib_.dir/src/gui.cpp.o
make[2]: * No rule to make target /Users/USER/anaconda/envs/keras/lib/libpython3.6.dylib', needed bydlib.so'. Stop.
make[1]: [CMakeFiles/dlib_.dir/all] Error 2
make: ** [all] Error 2
error: cmake build failed!
Does /Users/USER/anaconda/envs/keras/lib/libpython3.6.dylib exist? It sounds like your python install is missing important files.
Yes, it does. I did ls /Users/USER/anaconda/envs/keras/lib/libpython3.6.dylib and it showed up.
Well, beats me. Something is messed up with your python install.
I just want to update that you were right. I didn't have /Users/USER/anaconda/envs/keras/lib/libpython3.6.dylib. What I had was /Users/USER/anaconda/envs/keras/lib/libpython3.6m.dylib
I changed the filename from libpython3.6m.dylib to libpython3.6.dylib and the error went away.
That didn't work for me. I then copied my libpython3.6m.dylib file and renamed it to libpython3.6.dylib. Now I am getting this
[100%] Linking CXX shared library dlib.so
Undefined symbols for architecture x86_64:
"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:
void boost::python::detail::def_init_aux<boost::python::class_<mat_row, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>, boost::python::default_call_policies, boost::mpl::vector0<mpl_::na>, boost::mpl::size<boost::mpl::vector0<mpl_::na> > >(boost::python::class_<mat_row, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>&, boost::mpl::vector0<mpl_::na> const&, boost::mpl::size<boost::mpl::vector0<mpl_::na> >, boost::python::default_call_policies const&, char const*, std::__1::pair<boost::python::detail::keyword const*, boost::python::detail::keyword const*> const&) in matrix.cpp.o
void boost::python::class_<mat_row, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::def_impl<mat_row, long (*)(mat_row&), boost::python::detail::def_helper<char const*, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified> >(mat_row*, char const*, long (*)(mat_row&), boost::python::detail::def_helper<char const*, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified> const&, ...) in matrix.cpp.o
void boost::python::class_<mat_row, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::def_impl<mat_row, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > (*)(mat_row&), boost::python::detail::def_helper<char const*, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified> >(mat_row*, char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > (*)(mat_row&), boost::python::detail::def_helper<char const*, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified> const&, ...) in matrix.cpp.o
void boost::python::class_<mat_row, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::def_impl<mat_row, void (*)(mat_row&, long, double), boost::python::detail::def_helper<char const*, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified> >(mat_row*, char const*, void (*)(mat_row&, long, double), boost::python::detail::def_helper<char const*, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified> const&, ...) in matrix.cpp.o
void boost::python::class_<mat_row, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::def_impl<mat_row, double (*)(mat_row&, long), boost::python::detail::def_helper<char const*, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified> >(mat_row*, char const*, double (*)(mat_row&, long), boost::python::detail::def_helper<char const*, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified> const&, ...) in matrix.cpp.o
void boost::python::detail::def_init_aux<boost::python::class_<dlib::matrix<double, 0l, 0l, dlib::memory_manager_stateless_kernel_1<char>, dlib::row_major_layout>, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>, boost::python::default_call_policies, boost::mpl::vector0<mpl_::na>, boost::mpl::size<boost::mpl::vector0<mpl_::na> > >(boost::python::class_<dlib::matrix<double, 0l, 0l, dlib::memory_manager_stateless_kernel_1<char>, dlib::row_major_layout>, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>&, boost::mpl::vector0<mpl_::na> const&, boost::mpl::size<boost::mpl::vector0<mpl_::na> >, boost::python::default_call_policies const&, char const*, std::__1::pair<boost::python::detail::keyword const*, boost::python::detail::keyword const*> const&) in matrix.cpp.o
void boost::python::class_<dlib::matrix<double, 0l, 0l, dlib::memory_manager_stateless_kernel_1<char>, dlib::row_major_layout>, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::def_impl<dlib::matrix<double, 0l, 0l, dlib::memory_manager_stateless_kernel_1<char>, dlib::row_major_layout>, void (*)(dlib::matrix<double, 0l, 0l, dlib::memory_manager_stateless_kernel_1<char>, dlib::row_major_layout>&, long, long), boost::python::detail::def_helper<boost::python::detail::keywords<2ul>, char [68], boost::python::detail::not_specified, boost::python::detail::not_specified> >(dlib::matrix<double, 0l, 0l, dlib::memory_manager_stateless_kernel_1<char>, dlib::row_major_layout>*, char const*, void (*)(dlib::matrix<double, 0l, 0l, dlib::memory_manager_stateless_kernel_1<char>, dlib::row_major_layout>&, long, long), boost::python::detail::def_helper<boost::python::detail::keywords<2ul>, char [68], boost::python::detail::not_specified, boost::python::detail::not_specified> const&, ...) in matrix.cpp.o
...
"boost::python::objects::register_dynamic_id_aux(boost::python::type_info, std::__1::pair<void*, boost::python::type_info> (*)(void*))", referenced from:
bind_matrix() in matrix.cpp.o
bind_vector() in vector.cpp.o
boost::python::api::object boost::python::objects::detail::demand_iterator_class<std::__1::__wrap_iter<dlib::vector<long, 2l>*>, boost::python::return_internal_reference<1ul, boost::python::default_call_policies> >(char const*, std::__1::__wrap_iter<dlib::vector<long, 2l>*>*, boost::python::return_internal_reference<1ul, boost::python::default_call_policies> const&) in vector.cpp.o
boost::python::class_<dlib::svm_c_linear_trainer<dlib::linear_kernel<dlib::matrix<double, 0l, 1l, dlib::memory_manager_stateless_kernel_1<char>, dlib::row_major_layout> > >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified> setup_trainer<dlib::svm_c_linear_trainer<dlib::linear_kernel<dlib::matrix<double, 0l, 1l, dlib::memory_manager_stateless_kernel_1<char>, dlib::row_major_layout> > > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in svm_c_trainer.cpp.o
boost::python::class_<dlib::svm_c_linear_trainer<dlib::sparse_linear_kernel<std::__1::vector<std::__1::pair<unsigned long, double>, std::__1::allocator<std::__1::pair<unsigned long, double> > > > >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified> setup_trainer<dlib::svm_c_linear_trainer<dlib::sparse_linear_kernel<std::__1::vector<std::__1::pair<unsigned long, double>, std::__1::allocator<std::__1::pair<unsigned long, double> > > > > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in svm_c_trainer.cpp.o
boost::python::class_<dlib::svm_c_trainer<dlib::radial_basis_kernel<dlib::matrix<double, 0l, 1l, dlib::memory_manager_stateless_kernel_1<char>, dlib::row_major_layout> > >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified> setup_trainer<dlib::svm_c_trainer<dlib::radial_basis_kernel<dlib::matrix<double, 0l, 1l, dlib::memory_manager_stateless_kernel_1<char>, dlib::row_major_layout> > > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in svm_c_trainer.cpp.o
boost::python::class_<dlib::svm_c_trainer<dlib::sparse_radial_basis_kernel<std::__1::vector<std::__1::pair<unsigned long, double>, std::__1::allocator<std::__1::pair<unsigned long, double> > > > >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified> setup_trainer<dlib::svm_c_trainer<dlib::sparse_radial_basis_kernel<std::__1::vector<std::__1::pair<unsigned long, double>, std::__1::allocator<std::__1::pair<unsigned long, double> > > > > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in svm_c_trainer.cpp.o
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [dlib.so] Error 1
make[1]: *** [CMakeFiles/dlib_.dir/all] Error 2
make: *** [all] Error 2
error: cmake build failed!
Encountered the same problem and I'm using Python 3.5.2 with pyenv. Solve it with reinstalling my python with the following instructions. you can backup with copying your /usr/local/var/pyenv/versions/3.5.2/envs to somewhere safe and restore later.
https://gist.github.com/jtbonhomme/3a6862ed1354312fd1a57a98c72ae450
I ran into the same problem running a conda virtual environment. I opened setup.py and changed the line (line 526) that read:
py_lib = os.path.join(get_config_var('LIBDIR'), 'libpython'+py_ver+'.dylib')
to:
py_lib = os.path.join(get_config_var('LIBDIR'), 'libpython'+py_ver+'m.dylib')
I just added the m before .dylib and now it works!
Cool. One of you guys should post a PR that checks both of these file names and uses the one that exists :)
good idea! I'll get on that right now
On Thu, Jul 6, 2017 at 10:47 AM, Davis E. King notifications@github.com
wrote:
Cool. One of you guys should post a PR that checks both of these file
names and uses the one that exists :)—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/davisking/dlib/issues/465#issuecomment-313436648, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AWHyMiLjFy8cq1kHRnULngaUjWOQSGmPks5sLQGqgaJpZM4MR5aa
.
just need permission to push a new branch
That's not how github works. Clone a copy, modify it, submit a pull request.
big 'ol dingus here, forked, modified, and submitted
Na, no worries :)
This has been merged and resolved now in setup.py, but not in the pip install (as a note for others with the issue).
Most helpful comment
I just want to update that you were right. I didn't have
/Users/USER/anaconda/envs/keras/lib/libpython3.6.dylib. What I had was/Users/USER/anaconda/envs/keras/lib/libpython3.6m.dylibI changed the filename from
libpython3.6m.dylibtolibpython3.6.dyliband the error went away.