Instantly share code, notes, and snippets.

Embed
What would you like to do?

How to install dlib v19.9 or newer (w/ python bindings) from github on macOS and Ubuntu

Pre-reqs:

  • Have Python 3 installed. On macOS, this could be installed from homebrew or even via standard Python 3.6 downloaded installer from https://www.python.org/download. On Linux, just use your package manager.
  • On macOS:
    • Install XCode from the Mac App Store (or install the XCode command line utils).
    • Have homebrew installed
  • On Linux:
    • For a full list of apt packages required, check out the example Dockerfile and copy what's installed there.
    • These instructions assume you are using Ubuntu 16.04 or newer. If you are using 14.04, you can try these installation instructions instead to work around the old CMake version.
  • These instructions assume you don't have an nVidia GPU and don't have Cuda and cuDNN installed and don't want GPU acceleration (since none of the current Mac models support this).

Clone the code from github:

git clone https://github.com/davisking/dlib.git

Build the main dlib library (optional if you just want to use Python):

cd dlib
mkdir build; cd build; cmake ..; cmake --build .

Build and install the Python extensions:

cd ..
python3 setup.py install

At this point, you should be able to run python3 and type import dlib successfully.

@mdmedley

This comment has been minimized.

Show comment
Hide comment
@mdmedley

mdmedley Mar 16, 2017

If you run into issues with a Boost dependency and if you're not careful, like me, you'll have Boost linking with Python 2. No worries, you can solve the issue with this:

brew reinstall boost-python --with-python3 --without-python

Good luck!

mdmedley commented Mar 16, 2017

If you run into issues with a Boost dependency and if you're not careful, like me, you'll have Boost linking with Python 2. No worries, you can solve the issue with this:

brew reinstall boost-python --with-python3 --without-python

Good luck!

@mathslimin

This comment has been minimized.

Show comment
Hide comment
@mathslimin

mathslimin Mar 17, 2017

in mac os x:
build fail

[100%] Linking CXX shared library dlib.so
Undefined symbols for architecture x86_64:
"boost::python::detail::init_module(char const*, void (*)())", referenced from:
initdlib in dlib.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!

mathslimin commented Mar 17, 2017

in mac os x:
build fail

[100%] Linking CXX shared library dlib.so
Undefined symbols for architecture x86_64:
"boost::python::detail::init_module(char const*, void (*)())", referenced from:
initdlib in dlib.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!

@mdmedley

This comment has been minimized.

Show comment
Hide comment
@mdmedley

mdmedley Mar 19, 2017

@mathslimin reinstall Boost with the command in my previous comment to solve that error.

mdmedley commented Mar 19, 2017

@mathslimin reinstall Boost with the command in my previous comment to solve that error.

@mathslimin

This comment has been minimized.

Show comment
Hide comment
@mathslimin

mathslimin Mar 21, 2017

centos:
after
yum install python34-devel
yum install boost-devel

python3
import dlib
ImportError: /usr/lib64/python3.4/site-packages/dlib-19.4.99-py3.4-linux-x86_64.egg/dlib/dlib.so: undefined symbol: _ZN5boost6python6detail11init_moduleER11PyModuleDefPFvvE

mathslimin commented Mar 21, 2017

centos:
after
yum install python34-devel
yum install boost-devel

python3
import dlib
ImportError: /usr/lib64/python3.4/site-packages/dlib-19.4.99-py3.4-linux-x86_64.egg/dlib/dlib.so: undefined symbol: _ZN5boost6python6detail11init_moduleER11PyModuleDefPFvvE

@RatchananPrasan

This comment has been minimized.

Show comment
Hide comment
@RatchananPrasan

RatchananPrasan Apr 4, 2017

How to install dlib on Windows or it's only on MacOS or Linux ?
I can not use cmake.

RatchananPrasan commented Apr 4, 2017

How to install dlib on Windows or it's only on MacOS or Linux ?
I can not use cmake.

@Lily520

This comment has been minimized.

Show comment
Hide comment
@Lily520

Lily520 Apr 8, 2017

When I run in ubuntu : cmake .. -DDLIB_USE_CUDA=0 -DUSE_AVX_INSTRUCTIONS=1
there are some clues:
-- C++11 activated (compiler doesn't have full C++11 support).
-- Searching for BLAS and LAPACK
-- checking for module 'cblas'
-- package 'cblas' not found
-- checking for module 'lapack'
-- package 'lapack' not found
-- Found Intel MKL BLAS/LAPACK library
-- Configuring done
-- Generating done
-- Build files have been written to: /home/zhoulili/install/dlib/build

so,was cmake successful?

Lily520 commented Apr 8, 2017

When I run in ubuntu : cmake .. -DDLIB_USE_CUDA=0 -DUSE_AVX_INSTRUCTIONS=1
there are some clues:
-- C++11 activated (compiler doesn't have full C++11 support).
-- Searching for BLAS and LAPACK
-- checking for module 'cblas'
-- package 'cblas' not found
-- checking for module 'lapack'
-- package 'lapack' not found
-- Found Intel MKL BLAS/LAPACK library
-- Configuring done
-- Generating done
-- Build files have been written to: /home/zhoulili/install/dlib/build

so,was cmake successful?

@Lily520

This comment has been minimized.

Show comment
Hide comment
@Lily520

Lily520 Apr 8, 2017

when I run :cmake --build .
there was error:
In file included from /home/zhoulili/install/dlib/dlib/dnn/cpu_dlib.cpp:9:0:
/home/zhoulili/install/dlib/dlib/dnn/tensor_tools.h:1365:36: error: ‘<::’ cannot begin a template-argument list [-fpermissive]
/home/zhoulili/install/dlib/dlib/dnn/tensor_tools.h:1365:36: note: ‘<:’ is an alternate spelling for ‘[’. Insert whitespace between ‘<’ and ‘::’
/home/zhoulili/install/dlib/dlib/dnn/tensor_tools.h:1365:36: note: (if you use ‘-fpermissive’ G++ will accept your code)
make[2]: *** [dlib/CMakeFiles/dlib.dir/dnn/cpu_dlib.cpp.o] Error 1
make[1]: *** [dlib/CMakeFiles/dlib.dir/all] Error 2
make: *** [all] Error 2

could you tell me how I shold do next?

Lily520 commented Apr 8, 2017

when I run :cmake --build .
there was error:
In file included from /home/zhoulili/install/dlib/dlib/dnn/cpu_dlib.cpp:9:0:
/home/zhoulili/install/dlib/dlib/dnn/tensor_tools.h:1365:36: error: ‘<::’ cannot begin a template-argument list [-fpermissive]
/home/zhoulili/install/dlib/dlib/dnn/tensor_tools.h:1365:36: note: ‘<:’ is an alternate spelling for ‘[’. Insert whitespace between ‘<’ and ‘::’
/home/zhoulili/install/dlib/dlib/dnn/tensor_tools.h:1365:36: note: (if you use ‘-fpermissive’ G++ will accept your code)
make[2]: *** [dlib/CMakeFiles/dlib.dir/dnn/cpu_dlib.cpp.o] Error 1
make[1]: *** [dlib/CMakeFiles/dlib.dir/all] Error 2
make: *** [all] Error 2

could you tell me how I shold do next?

@RatchananPrasan

This comment has been minimized.

Show comment
Hide comment
@RatchananPrasan

RatchananPrasan Apr 15, 2017

I run
python3 setup.py install --yes USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA
in Raspberry Pi 3 and ram are not enough to run at 96% "object_detection.cpp.o" .

RatchananPrasan commented Apr 15, 2017

I run
python3 setup.py install --yes USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA
in Raspberry Pi 3 and ram are not enough to run at 96% "object_detection.cpp.o" .

@zr0z

This comment has been minimized.

Show comment
Hide comment
@zr0z

zr0z Apr 20, 2017

@RatchananPrasan I had the same issue.

I solved it by running in console without X and closing most of services (SSH, VNC,...) in raspi-config.
I also grew the size of the Swapfile temporarily to 1024 Mb (The link I used).

zr0z commented Apr 20, 2017

@RatchananPrasan I had the same issue.

I solved it by running in console without X and closing most of services (SSH, VNC,...) in raspi-config.
I also grew the size of the Swapfile temporarily to 1024 Mb (The link I used).

@winnerineast

This comment has been minimized.

Show comment
Hide comment
@winnerineast

winnerineast Apr 24, 2017

I hit the error on the step of 'python3 setup.py install --yes USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA' in my MacOS.
[ 99%] Building CXX object CMakeFiles/dlib_.dir/src/gui.cpp.o
make[2]: *** No rule to make target /Users/winnerineast/anaconda/lib/libpython3.6.dylib', needed bydlib.so'. Stop.
make[1]: *** [CMakeFiles/dlib_.dir/all] Error 2
make: *** [all] Error 2
error: cmake build failed!

winnerineast commented Apr 24, 2017

I hit the error on the step of 'python3 setup.py install --yes USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA' in my MacOS.
[ 99%] Building CXX object CMakeFiles/dlib_.dir/src/gui.cpp.o
make[2]: *** No rule to make target /Users/winnerineast/anaconda/lib/libpython3.6.dylib', needed bydlib.so'. Stop.
make[1]: *** [CMakeFiles/dlib_.dir/all] Error 2
make: *** [all] Error 2
error: cmake build failed!

@elf55

This comment has been minimized.

Show comment
Hide comment
@elf55

elf55 Apr 26, 2017

In response to winnerineast: this failed because the anaconda distro name for the referenced lib is libpython3.6m.dylab. There are probably several correct way you can fix this, but I just edited the setup.py file to insert the "m". It's on line 526 and the block you are looking for is:

# by default, cmake will choose the system python lib in /usr/lib
# this checks the sysconfig and will correctly pick up a brewed python lib
# e.g. in /usr/local/Cellar
py_ver = get_python_version()
py_lib = os.path.join(get_config_var('LIBDIR'), 'libpython'+py_ver+'m'+'.dylib')
cmake_extra_arch += ['-DPYTHON_LIBRARY={lib}'.format(lib=py_lib)]

The edit is to insert +'m' into the py_lib string. After that, it should complete the make without the error.

elf55 commented Apr 26, 2017

In response to winnerineast: this failed because the anaconda distro name for the referenced lib is libpython3.6m.dylab. There are probably several correct way you can fix this, but I just edited the setup.py file to insert the "m". It's on line 526 and the block you are looking for is:

# by default, cmake will choose the system python lib in /usr/lib
# this checks the sysconfig and will correctly pick up a brewed python lib
# e.g. in /usr/local/Cellar
py_ver = get_python_version()
py_lib = os.path.join(get_config_var('LIBDIR'), 'libpython'+py_ver+'m'+'.dylib')
cmake_extra_arch += ['-DPYTHON_LIBRARY={lib}'.format(lib=py_lib)]

The edit is to insert +'m' into the py_lib string. After that, it should complete the make without the error.

@Mikebarson

This comment has been minimized.

Show comment
Hide comment
@Mikebarson

Mikebarson Apr 26, 2017

Will this work for python2?

Mikebarson commented Apr 26, 2017

Will this work for python2?

@CristaLCorp

This comment has been minimized.

Show comment
Hide comment
@CristaLCorp

CristaLCorp May 12, 2017

Hi, i'm using Kali, followed all the steps :
Install libboost, compile dlib... but

if I install libboost-all-dev, dlib can't import libboost_python.so.1.64.0 (as I believe it installs the 1.62 version)
if i compile libboost 1.64 from source, it complains that "undefined symbol: PyClass_Type" (which was supposed to be an old bug fixed in version 1.47).
Is there a workaround like compile option for dlib to use 1.62 ? or am i doing something wrong ?

thanks

CristaLCorp commented May 12, 2017

Hi, i'm using Kali, followed all the steps :
Install libboost, compile dlib... but

if I install libboost-all-dev, dlib can't import libboost_python.so.1.64.0 (as I believe it installs the 1.62 version)
if i compile libboost 1.64 from source, it complains that "undefined symbol: PyClass_Type" (which was supposed to be an old bug fixed in version 1.47).
Is there a workaround like compile option for dlib to use 1.62 ? or am i doing something wrong ?

thanks

@sunyongke

This comment has been minimized.

Show comment
Hide comment
@sunyongke

sunyongke May 15, 2017

I meet a error in the Mac OSX sierra(10.12.4)
anybody help me?

In file included from /usr/local/include/boost/function/function0.hpp:11:
In file included from /usr/local/include/boost/function/detail/maybe_include.hpp:13:
In file included from /usr/local/include/boost/function/function_template.hpp:13:
In file included from /usr/local/include/boost/function/detail/prologue.hpp:13:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:865:22: error: invalid operands to binary expression ('dlib::full_object_detection' and 'const dlib::full_object_detection')
if (*__first == _value)
~~~~~~~~ ^ ~~~~~~~~
/usr/local/include/boost/python/suite/indexing/vector_indexing_suite.hpp:146:25: note: in instantiation of function template specialization 'std::__1::find<std::__1::__wrap_iter<dlib::full_object_detection *>, dlib::full_object_detection>' requested here
return std::find(container.begin(), container.end(), key)
^
/usr/local/include/boost/python/suite/indexing/indexing_suite.hpp:279:41: note: in instantiation of member function 'boost::python::vector_indexing_suite<std::__1::vector<dlib::full_object_detection, std::__1::allocatordlib::full_object_detection >, false, boost::python::detail::final_vector_derived_policies<std::__1::vector<dlib::full_object_detection, std::__1::allocatordlib::full_object_detection >, false> >::contains' requested here
return DerivedPolicies::contains(container, x());
^
/usr/local/include/boost/python/suite/indexing/indexing_suite.hpp:185:39: note: in instantiation of member function 'boost::python::indexing_suite<std::__1::vector<dlib::full_object_detection, std::__1::allocatordlib::full_object_detection >, boost::python::detail::final_vector_derived_policies<std::__1::vector<dlib::full_object_detection, std::__1::allocatordlib::full_object_detection >, false>, false, false, dlib::full_object_detection, unsigned long, dlib::full_object_detection>::base_contains' requested here
.def("contains", &base_contains)
^
/usr/local/include/boost/python/def_visitor.hpp:31:29: note: in instantiation of function template specialization 'boost::python::indexing_suite<std::__1::vector<dlib::full_object_detection, std::__1::allocatordlib::full_object_detection >, boost::python::detail::final_vector_derived_policies<std::__1::vector<dlib::full_object_detection, std::_1::allocatordlib::full_object_detection >, false>, false, false, dlib::full_object_detection, unsigned long, dlib::full_object_detection>::visit<boost::python::class<std::__1::vector<dlib::full_object_detection, std::__1::allocatordlib::full_object_detection >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified> >' requested here
v.derived_visitor().visit(c);
^
/usr/local/include/boost/python/def_visitor.hpp:67:29: note: in instantiation of function template specialization 'boost::python::def_visitor_access::visit<boost::python::def_visitor<boost::python::indexing_suite<std::__1::vector<dlib::full_object_detection, std::__1::allocatordlib::full_object_detection >, boost::python::detail::final_vector_derived_policies<std::__1::vector<dlib::full_object_detection, std::_1::allocatordlib::full_object_detection >, false>, false, false, dlib::full_object_detection, unsigned long, dlib::full_object_detection> >, boost::python::class<std::__1::vector<dlib::full_object_detection, std::__1::allocatordlib::full_object_detection >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified> >' requested here
def_visitor_access::visit(*this, c);
^
/usr/local/include/boost/python/class.hpp:225:17: note: in instantiation of function template specialization 'boost::python::def_visitor<boost::python::indexing_suite<std::__1::vector<dlib::full_object_detection, std::__1::allocatordlib::full_object_detection >, boost::python::detail::final_vector_derived_policies<std::__1::vector<dlib::full_object_detection, std::_1::allocatordlib::full_object_detection >, false>, false, false, dlib::full_object_detection, unsigned long, dlib::full_object_detection> >::visit<boost::python::class<std::__1::vector<dlib::full_object_detection, std::_1::allocatordlib::full_object_detection >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified> >' requested here
visitor.visit(*this);
^
/Users/syk/Downloads/dlib/tools/python/src/face_recognition.cpp:164:10: note: in instantiation of function template specialization 'boost::python::class
<std::__1::vector<dlib::full_object_detection, std::__1::allocatordlib::full_object_detection >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::def<boost::python::indexing_suite<std::__1::vector<dlib::full_object_detection, std::__1::allocatordlib::full_object_detection >, boost::python::detail::final_vector_derived_policies<std::__1::vector<dlib::full_object_detection, std::__1::allocatordlib::full_object_detection >, false>, false, false, dlib::full_object_detection, unsigned long, dlib::full_object_detection> >' requested here
.def(vector_indexing_suite())
^
/usr/local/include/dlib/svm/../graph_utils/sample_pair.h:118:17: note: candidate function not viable: no known conversion from 'dlib::full_object_detection' to 'const dlib::sample_pair' for 1st argument
inline bool operator == (
^
/usr/local/include/dlib/svm/../graph_utils/ordered_sample_pair.h:64:17: note: candidate function not viable: no known conversion from 'dlib::full_object_detection' to 'const dlib::ordered_sample_pair' for 1st argument
inline bool operator == (
^
/usr/local/include/dlib/array2d/../geometry/../image_processing/../image_transforms/../simd/simd4i.h:265:19: note: candidate function not viable: no known conversion from 'dlib::full_object_detection' to 'const dlib::simd4i' for 1st argument
inline simd4i operator== (const simd4i& lhs, const simd4i& rhs)
^
/usr/local/include/dlib/array2d/../geometry/../image_processing/../image_transforms/../simd/simd4f.h:253:24: note: candidate function not viable: no known conversion from 'dlib::full_object_detection' to 'const dlib::simd4f' for 1st argument
inline simd4f_bool operator== (const simd4f& lhs, const simd4f& rhs)
^
/usr/local/include/dlib/simd/simd8i.h:239:19: note: candidate function not viable: no known conversion from 'dlib::full_object_detection' to 'const dlib::simd8i' for 1st argument
inline simd8i operator== (const simd8i& lhs, const simd8i& rhs)
^
/usr/local/include/dlib/simd/simd8f.h:216:24: note: candidate function not viable: no known conversion from 'dlib::full_object_detection' to 'const dlib::simd8f' for 1st argument
inline simd8f_bool operator== (const simd8f& lhs, const simd8f& rhs)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/utility:414:1: note: candidate template ignored: could not match 'pair<type-parameter-0-0, type-parameter-0-1>' against 'dlib::full_object_detection'
operator==(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iterator:584:1: note: candidate template ignored: could not match 'reverse_iterator' against 'dlib::full_object_detection'
operator==(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iterator:885:6: note: candidate template ignored: could not match 'istreambuf_iterator<type-parameter-0-0, type-parameter-0-1>' against 'dlib::full_object_detection'
bool operator==(const istreambuf_iterator<_CharT,_Traits>& __a,
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iterator:988:1: note: candidate template ignored: could not match 'move_iterator' against 'dlib::full_object_detection'
operator==(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iterator:1304:1: note: candidate template ignored: could not match '__wrap_iter' against 'dlib::full_object_detection'
operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/tuple:909:1: note: candidate template ignored: could not match 'tuple<type-parameter-0-0...>' against 'dlib::full_object_detection'
operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:1903:6: note: candidate template ignored: could not match 'allocator' against 'dlib::full_object_detection'
bool operator==(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return true;}
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2985:1: note: candidate template ignored: could not match 'unique_ptr<type-parameter-0-0, type-parameter-0-1>' against 'dlib::full_object_detection'
operator==(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return __x.get() == __y.get();}
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3021:1: note: candidate template ignored: could not match 'unique_ptr<type-parameter-0-0, type-parameter-0-1>' against 'dlib::full_object_detection'
operator==(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3029:1: note: candidate template ignored: could not match 'unique_ptr<type-parameter-0-0, type-parameter-0-1>' against 'const dlib::full_object_detection'
operator==(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4873:1: note: candidate template ignored: could not match 'shared_ptr' against 'dlib::full_object_detection'
operator==(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4922:1: note: candidate template ignored: could not match 'shared_ptr' against 'dlib::full_object_detection'
operator==(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4930:1: note: candidate template ignored: could not match 'shared_ptr' against 'const dlib::full_object_detection'
operator==(nullptr_t, const shared_ptr<_Tp>& _x) NOEXCEPT
^
/usr/local/include/dlib/smart_pointers/shared_ptr.h:464:10: note: candidate template ignored: could not match 'shared_ptr' against 'dlib::full_object_detection'
bool operator== (
^
/usr/local/include/dlib/matrix/lapack/../matrix.h:935:10: note: candidate template ignored: could not match 'matrix_exp' against 'dlib::full_object_detection'
bool operator== (
^
/usr/local/include/dlib/svm/../std_allocator.h:173:10: note: candidate template ignored: could not match 'std_allocator<type-parameter-0-0, type-parameter-0-1>' against 'dlib::full_object_detection'
bool operator== (
^
/usr/local/include/dlib/matrix/matrix_utilities.h:1349:97: note: candidate template ignored: could not match 'matrix_exp' against 'dlib::full_object_detection'
const typename enable_if<is_built_in_scalar_type, matrix_op<op_equal_to<EXP,S> > >::type operator== (
^
/usr/local/include/dlib/matrix/matrix_utilities.h:1366:97: note: candidate template ignored: could not match 'matrix_exp' against 'const dlib::full_object_detection'
const typename enable_if<is_built_in_scalar_type, matrix_op<op_equal_to<EXP,S> > >::type operator== (
^
/usr/local/include/dlib/smart_pointers/shared_ptr_thread_safe.h:432:10: note: candidate template ignored: could not match 'shared_ptr_thread_safe' against 'dlib::full_object_detection'
bool operator== (
^
/usr/local/include/dlib/threads/thread_pool_extension.h:107:32: note: candidate template ignored: could not match 'future' against 'dlib::full_object_detection'
template bool operator== (const future& a, const future& b) { return a.get() == b.get(); }
^
/usr/local/include/dlib/threads/thread_pool_extension.h:114:32: note: candidate template ignored: could not match 'future' against 'dlib::full_object_detection'
template bool operator== (const future& a, const T& b) { return a.get() == b; }
^
/usr/local/include/dlib/threads/thread_pool_extension.h:115:32: note: candidate template ignored: could not match 'future' against 'const dlib::full_object_detection'
template bool operator== (const T& a, const future& b) { return a == b.get(); }
^
/usr/local/include/dlib/svm/../unordered_pair.h:96:10: note: candidate template ignored: could not match 'unordered_pair' against 'dlib::full_object_detection'
bool operator==(const unordered_pair& a, const unordered_pair & b)
^
4 warnings and 1 error generated.
make[2]: *** [CMakeFiles/dlib
.dir/src/face_recognition.cpp.o] Error 1
make[1]: *** [CMakeFiles/dlib
.dir/all] Error 2
make: *** [all] Error 2
error: cmake build failed!

sunyongke commented May 15, 2017

I meet a error in the Mac OSX sierra(10.12.4)
anybody help me?

In file included from /usr/local/include/boost/function/function0.hpp:11:
In file included from /usr/local/include/boost/function/detail/maybe_include.hpp:13:
In file included from /usr/local/include/boost/function/function_template.hpp:13:
In file included from /usr/local/include/boost/function/detail/prologue.hpp:13:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:865:22: error: invalid operands to binary expression ('dlib::full_object_detection' and 'const dlib::full_object_detection')
if (*__first == _value)
~~~~~~~~ ^ ~~~~~~~~
/usr/local/include/boost/python/suite/indexing/vector_indexing_suite.hpp:146:25: note: in instantiation of function template specialization 'std::__1::find<std::__1::__wrap_iter<dlib::full_object_detection *>, dlib::full_object_detection>' requested here
return std::find(container.begin(), container.end(), key)
^
/usr/local/include/boost/python/suite/indexing/indexing_suite.hpp:279:41: note: in instantiation of member function 'boost::python::vector_indexing_suite<std::__1::vector<dlib::full_object_detection, std::__1::allocatordlib::full_object_detection >, false, boost::python::detail::final_vector_derived_policies<std::__1::vector<dlib::full_object_detection, std::__1::allocatordlib::full_object_detection >, false> >::contains' requested here
return DerivedPolicies::contains(container, x());
^
/usr/local/include/boost/python/suite/indexing/indexing_suite.hpp:185:39: note: in instantiation of member function 'boost::python::indexing_suite<std::__1::vector<dlib::full_object_detection, std::__1::allocatordlib::full_object_detection >, boost::python::detail::final_vector_derived_policies<std::__1::vector<dlib::full_object_detection, std::__1::allocatordlib::full_object_detection >, false>, false, false, dlib::full_object_detection, unsigned long, dlib::full_object_detection>::base_contains' requested here
.def("contains", &base_contains)
^
/usr/local/include/boost/python/def_visitor.hpp:31:29: note: in instantiation of function template specialization 'boost::python::indexing_suite<std::__1::vector<dlib::full_object_detection, std::__1::allocatordlib::full_object_detection >, boost::python::detail::final_vector_derived_policies<std::__1::vector<dlib::full_object_detection, std::_1::allocatordlib::full_object_detection >, false>, false, false, dlib::full_object_detection, unsigned long, dlib::full_object_detection>::visit<boost::python::class<std::__1::vector<dlib::full_object_detection, std::__1::allocatordlib::full_object_detection >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified> >' requested here
v.derived_visitor().visit(c);
^
/usr/local/include/boost/python/def_visitor.hpp:67:29: note: in instantiation of function template specialization 'boost::python::def_visitor_access::visit<boost::python::def_visitor<boost::python::indexing_suite<std::__1::vector<dlib::full_object_detection, std::__1::allocatordlib::full_object_detection >, boost::python::detail::final_vector_derived_policies<std::__1::vector<dlib::full_object_detection, std::_1::allocatordlib::full_object_detection >, false>, false, false, dlib::full_object_detection, unsigned long, dlib::full_object_detection> >, boost::python::class<std::__1::vector<dlib::full_object_detection, std::__1::allocatordlib::full_object_detection >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified> >' requested here
def_visitor_access::visit(*this, c);
^
/usr/local/include/boost/python/class.hpp:225:17: note: in instantiation of function template specialization 'boost::python::def_visitor<boost::python::indexing_suite<std::__1::vector<dlib::full_object_detection, std::__1::allocatordlib::full_object_detection >, boost::python::detail::final_vector_derived_policies<std::__1::vector<dlib::full_object_detection, std::_1::allocatordlib::full_object_detection >, false>, false, false, dlib::full_object_detection, unsigned long, dlib::full_object_detection> >::visit<boost::python::class<std::__1::vector<dlib::full_object_detection, std::_1::allocatordlib::full_object_detection >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified> >' requested here
visitor.visit(*this);
^
/Users/syk/Downloads/dlib/tools/python/src/face_recognition.cpp:164:10: note: in instantiation of function template specialization 'boost::python::class
<std::__1::vector<dlib::full_object_detection, std::__1::allocatordlib::full_object_detection >, boost::python::detail::not_specified, boost::python::detail::not_specified, boost::python::detail::not_specified>::def<boost::python::indexing_suite<std::__1::vector<dlib::full_object_detection, std::__1::allocatordlib::full_object_detection >, boost::python::detail::final_vector_derived_policies<std::__1::vector<dlib::full_object_detection, std::__1::allocatordlib::full_object_detection >, false>, false, false, dlib::full_object_detection, unsigned long, dlib::full_object_detection> >' requested here
.def(vector_indexing_suite())
^
/usr/local/include/dlib/svm/../graph_utils/sample_pair.h:118:17: note: candidate function not viable: no known conversion from 'dlib::full_object_detection' to 'const dlib::sample_pair' for 1st argument
inline bool operator == (
^
/usr/local/include/dlib/svm/../graph_utils/ordered_sample_pair.h:64:17: note: candidate function not viable: no known conversion from 'dlib::full_object_detection' to 'const dlib::ordered_sample_pair' for 1st argument
inline bool operator == (
^
/usr/local/include/dlib/array2d/../geometry/../image_processing/../image_transforms/../simd/simd4i.h:265:19: note: candidate function not viable: no known conversion from 'dlib::full_object_detection' to 'const dlib::simd4i' for 1st argument
inline simd4i operator== (const simd4i& lhs, const simd4i& rhs)
^
/usr/local/include/dlib/array2d/../geometry/../image_processing/../image_transforms/../simd/simd4f.h:253:24: note: candidate function not viable: no known conversion from 'dlib::full_object_detection' to 'const dlib::simd4f' for 1st argument
inline simd4f_bool operator== (const simd4f& lhs, const simd4f& rhs)
^
/usr/local/include/dlib/simd/simd8i.h:239:19: note: candidate function not viable: no known conversion from 'dlib::full_object_detection' to 'const dlib::simd8i' for 1st argument
inline simd8i operator== (const simd8i& lhs, const simd8i& rhs)
^
/usr/local/include/dlib/simd/simd8f.h:216:24: note: candidate function not viable: no known conversion from 'dlib::full_object_detection' to 'const dlib::simd8f' for 1st argument
inline simd8f_bool operator== (const simd8f& lhs, const simd8f& rhs)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/utility:414:1: note: candidate template ignored: could not match 'pair<type-parameter-0-0, type-parameter-0-1>' against 'dlib::full_object_detection'
operator==(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iterator:584:1: note: candidate template ignored: could not match 'reverse_iterator' against 'dlib::full_object_detection'
operator==(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iterator:885:6: note: candidate template ignored: could not match 'istreambuf_iterator<type-parameter-0-0, type-parameter-0-1>' against 'dlib::full_object_detection'
bool operator==(const istreambuf_iterator<_CharT,_Traits>& __a,
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iterator:988:1: note: candidate template ignored: could not match 'move_iterator' against 'dlib::full_object_detection'
operator==(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iterator:1304:1: note: candidate template ignored: could not match '__wrap_iter' against 'dlib::full_object_detection'
operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/tuple:909:1: note: candidate template ignored: could not match 'tuple<type-parameter-0-0...>' against 'dlib::full_object_detection'
operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:1903:6: note: candidate template ignored: could not match 'allocator' against 'dlib::full_object_detection'
bool operator==(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return true;}
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2985:1: note: candidate template ignored: could not match 'unique_ptr<type-parameter-0-0, type-parameter-0-1>' against 'dlib::full_object_detection'
operator==(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return __x.get() == __y.get();}
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3021:1: note: candidate template ignored: could not match 'unique_ptr<type-parameter-0-0, type-parameter-0-1>' against 'dlib::full_object_detection'
operator==(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3029:1: note: candidate template ignored: could not match 'unique_ptr<type-parameter-0-0, type-parameter-0-1>' against 'const dlib::full_object_detection'
operator==(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4873:1: note: candidate template ignored: could not match 'shared_ptr' against 'dlib::full_object_detection'
operator==(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4922:1: note: candidate template ignored: could not match 'shared_ptr' against 'dlib::full_object_detection'
operator==(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4930:1: note: candidate template ignored: could not match 'shared_ptr' against 'const dlib::full_object_detection'
operator==(nullptr_t, const shared_ptr<_Tp>& _x) NOEXCEPT
^
/usr/local/include/dlib/smart_pointers/shared_ptr.h:464:10: note: candidate template ignored: could not match 'shared_ptr' against 'dlib::full_object_detection'
bool operator== (
^
/usr/local/include/dlib/matrix/lapack/../matrix.h:935:10: note: candidate template ignored: could not match 'matrix_exp' against 'dlib::full_object_detection'
bool operator== (
^
/usr/local/include/dlib/svm/../std_allocator.h:173:10: note: candidate template ignored: could not match 'std_allocator<type-parameter-0-0, type-parameter-0-1>' against 'dlib::full_object_detection'
bool operator== (
^
/usr/local/include/dlib/matrix/matrix_utilities.h:1349:97: note: candidate template ignored: could not match 'matrix_exp' against 'dlib::full_object_detection'
const typename enable_if<is_built_in_scalar_type, matrix_op<op_equal_to<EXP,S> > >::type operator== (
^
/usr/local/include/dlib/matrix/matrix_utilities.h:1366:97: note: candidate template ignored: could not match 'matrix_exp' against 'const dlib::full_object_detection'
const typename enable_if<is_built_in_scalar_type, matrix_op<op_equal_to<EXP,S> > >::type operator== (
^
/usr/local/include/dlib/smart_pointers/shared_ptr_thread_safe.h:432:10: note: candidate template ignored: could not match 'shared_ptr_thread_safe' against 'dlib::full_object_detection'
bool operator== (
^
/usr/local/include/dlib/threads/thread_pool_extension.h:107:32: note: candidate template ignored: could not match 'future' against 'dlib::full_object_detection'
template bool operator== (const future& a, const future& b) { return a.get() == b.get(); }
^
/usr/local/include/dlib/threads/thread_pool_extension.h:114:32: note: candidate template ignored: could not match 'future' against 'dlib::full_object_detection'
template bool operator== (const future& a, const T& b) { return a.get() == b; }
^
/usr/local/include/dlib/threads/thread_pool_extension.h:115:32: note: candidate template ignored: could not match 'future' against 'const dlib::full_object_detection'
template bool operator== (const T& a, const future& b) { return a == b.get(); }
^
/usr/local/include/dlib/svm/../unordered_pair.h:96:10: note: candidate template ignored: could not match 'unordered_pair' against 'dlib::full_object_detection'
bool operator==(const unordered_pair& a, const unordered_pair & b)
^
4 warnings and 1 error generated.
make[2]: *** [CMakeFiles/dlib
.dir/src/face_recognition.cpp.o] Error 1
make[1]: *** [CMakeFiles/dlib
.dir/all] Error 2
make: *** [all] Error 2
error: cmake build failed!

@CristaLCorp

This comment has been minimized.

Show comment
Hide comment
@CristaLCorp

CristaLCorp May 16, 2017

ok, i think no one is reading that feed anymore :)
I 've been trying on debian (jessie), got other problems...
maybe using the VM iso is our best chance

CristaLCorp commented May 16, 2017

ok, i think no one is reading that feed anymore :)
I 've been trying on debian (jessie), got other problems...
maybe using the VM iso is our best chance

@chriship

This comment has been minimized.

Show comment
Hide comment
@chriship

chriship May 23, 2017

I keep receiving the following error when trying to build the main library. I've tried removing and reinstalling libpng but no luck. Anyone have a suggestion for me?

[100%] Linking CXX shared library libdlib.dylib
Undefined symbols for architecture x86_64:
  "_png_set_longjmp_fn", referenced from:
      dlib::png_loader::read_image(char const*) in png_loader.cpp.o
      dlib::png_loader_user_error_fn_silent(png_struct_def*, char const*) in png_loader.cpp.o
      dlib::png_reader_user_error_fn_silent(png_struct_def*, char const*) in save_png.cpp.o
      dlib::impl::impl_save_png(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<unsigned char*, std::__1::allocator<unsigned char*> >&, long, dlib::impl::png_type, int) in save_png.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/libdlib.19.4.99.dylib] Error 1
make[1]: *** [dlib/CMakeFiles/dlib_shared.dir/all] Error 2
make: *** [all] Error 2

EDIT: Turns out my issue was something to do with libpng inside php5. I simply removed php5 and it installed.

chriship commented May 23, 2017

I keep receiving the following error when trying to build the main library. I've tried removing and reinstalling libpng but no luck. Anyone have a suggestion for me?

[100%] Linking CXX shared library libdlib.dylib
Undefined symbols for architecture x86_64:
  "_png_set_longjmp_fn", referenced from:
      dlib::png_loader::read_image(char const*) in png_loader.cpp.o
      dlib::png_loader_user_error_fn_silent(png_struct_def*, char const*) in png_loader.cpp.o
      dlib::png_reader_user_error_fn_silent(png_struct_def*, char const*) in save_png.cpp.o
      dlib::impl::impl_save_png(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<unsigned char*, std::__1::allocator<unsigned char*> >&, long, dlib::impl::png_type, int) in save_png.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/libdlib.19.4.99.dylib] Error 1
make[1]: *** [dlib/CMakeFiles/dlib_shared.dir/all] Error 2
make: *** [all] Error 2

EDIT: Turns out my issue was something to do with libpng inside php5. I simply removed php5 and it installed.

@alimehdi242

This comment has been minimized.

Show comment
Hide comment
@alimehdi242

alimehdi242 May 29, 2017

looks like no one knows how to install dlib in windows

alimehdi242 commented May 29, 2017

looks like no one knows how to install dlib in windows

@adamleo

This comment has been minimized.

Show comment
Hide comment
@adamleo

adamleo Jun 9, 2017

@elf55 BIG THUMB UP! Thanks!

adamleo commented Jun 9, 2017

@elf55 BIG THUMB UP! Thanks!

@erivandoramos

This comment has been minimized.

Show comment
Hide comment
@erivandoramos

erivandoramos Jun 9, 2017

Hi!

The my installation sudo python setup.py install --yes USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA failed here:

**[ 97%] Building CXX object CMakeFiles/dlib_.dir/src/face_recognition.cpp.o
c++: internal compiler error: Morto (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions.
CMakeFiles/dlib_.dir/build.make:446: recipe for target 'CMakeFiles/dlib_.dir/src/face_recognition.cpp.o' failed
make[2]: *** [CMakeFiles/dlib_.dir/src/face_recognition.cpp.o] Error 4
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/dlib_.dir/all' failed
make[1]: *** [CMakeFiles/dlib_.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
error: cmake build failed!**

There is a solution ??

erivandoramos commented Jun 9, 2017

Hi!

The my installation sudo python setup.py install --yes USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA failed here:

**[ 97%] Building CXX object CMakeFiles/dlib_.dir/src/face_recognition.cpp.o
c++: internal compiler error: Morto (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions.
CMakeFiles/dlib_.dir/build.make:446: recipe for target 'CMakeFiles/dlib_.dir/src/face_recognition.cpp.o' failed
make[2]: *** [CMakeFiles/dlib_.dir/src/face_recognition.cpp.o] Error 4
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/dlib_.dir/all' failed
make[1]: *** [CMakeFiles/dlib_.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
error: cmake build failed!**

There is a solution ??

@ShubhamVipulMajmudar

This comment has been minimized.

Show comment
Hide comment
@ShubhamVipulMajmudar

ShubhamVipulMajmudar Jun 13, 2017

I get this after 99%. Help, stuck here since forever!

[ 95%] Building CXX object CMakeFiles/dlib_.dir/src/object_detection.cpp.o
[ 96%] Building CXX object CMakeFiles/dlib_.dir/src/shape_predictor.cpp.o
[ 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/cereteam/anaconda3/lib/libpython3.6.dylib', needed by `dlib.so'.  Stop.
make[1]: *** [CMakeFiles/dlib_.dir/all] Error 2
make: *** [all] Error 2
error: cmake build failed!

ShubhamVipulMajmudar commented Jun 13, 2017

I get this after 99%. Help, stuck here since forever!

[ 95%] Building CXX object CMakeFiles/dlib_.dir/src/object_detection.cpp.o
[ 96%] Building CXX object CMakeFiles/dlib_.dir/src/shape_predictor.cpp.o
[ 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/cereteam/anaconda3/lib/libpython3.6.dylib', needed by `dlib.so'.  Stop.
make[1]: *** [CMakeFiles/dlib_.dir/all] Error 2
make: *** [all] Error 2
error: cmake build failed!
@GonzaBCCC

This comment has been minimized.

Show comment
Hide comment
@GonzaBCCC

GonzaBCCC Jun 20, 2017

After following the installation steps, i still get this message whenever trying to import dlib or even face_recognition:

$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import dlib
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/dlib-19.4.99-py2.7-linux-x86_64.egg/dlib/init.py", line 1, in
from .dlib import *
ImportError: libcublas.so.8.0: cannot open shared object file: No such file or directory

Any idea what this could be? I have cuda 8.0 correctly installed in ubuntu 16.04

GonzaBCCC commented Jun 20, 2017

After following the installation steps, i still get this message whenever trying to import dlib or even face_recognition:

$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import dlib
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/dlib-19.4.99-py2.7-linux-x86_64.egg/dlib/init.py", line 1, in
from .dlib import *
ImportError: libcublas.so.8.0: cannot open shared object file: No such file or directory

Any idea what this could be? I have cuda 8.0 correctly installed in ubuntu 16.04

@liweisnake

This comment has been minimized.

Show comment
Hide comment
@liweisnake

liweisnake Jul 30, 2017

thanks for ageitgey that build such amazing project.
here I just want to show a issue that I solved in my machine, maybe can help someone.
I just follow the step to build dlib from source and then build face_recognition, when I run example, it shows me Illegal Instruction. When I first changed set(USE_SSE4_INSTRUCTIONS ON CACHE BOOL "Use SSE4 instructions")
to: set(USE_SSE2_INSTRUCTIONS ON CACHE BOOL "Use SSE2 instructions")
and recompile dlib again, but find it still the same problem.
Then I use cat /proc/cpuinfo, find my flag:
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes hypervisor lahf_lm tsc_adjust dtherm arat

I found my cpu support sse2, also sse4, so the steps above did not help me. and also I found my cpu doesn't support avx, so when I compile again with following command and then I success. hope can help you

cmake .. -DDLIB_USE_CUDA=0; cmake --build .

python3 setup.py install --no USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA

liweisnake commented Jul 30, 2017

thanks for ageitgey that build such amazing project.
here I just want to show a issue that I solved in my machine, maybe can help someone.
I just follow the step to build dlib from source and then build face_recognition, when I run example, it shows me Illegal Instruction. When I first changed set(USE_SSE4_INSTRUCTIONS ON CACHE BOOL "Use SSE4 instructions")
to: set(USE_SSE2_INSTRUCTIONS ON CACHE BOOL "Use SSE2 instructions")
and recompile dlib again, but find it still the same problem.
Then I use cat /proc/cpuinfo, find my flag:
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes hypervisor lahf_lm tsc_adjust dtherm arat

I found my cpu support sse2, also sse4, so the steps above did not help me. and also I found my cpu doesn't support avx, so when I compile again with following command and then I success. hope can help you

cmake .. -DDLIB_USE_CUDA=0; cmake --build .

python3 setup.py install --no USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA

@SteinCoda

This comment has been minimized.

Show comment
Hide comment
@SteinCoda

SteinCoda Aug 17, 2017

Hi @erivandoramos I meet the same error.

When I try :python setup.py install --yes USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA
error: c++: internal compiler error
reason: maybe memory not enough
solution:
1、change you virtual machine memory ( it works for me ! )
2、change spaw space ubuntu How to change spaw space or similar issue

SteinCoda commented Aug 17, 2017

Hi @erivandoramos I meet the same error.

When I try :python setup.py install --yes USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA
error: c++: internal compiler error
reason: maybe memory not enough
solution:
1、change you virtual machine memory ( it works for me ! )
2、change spaw space ubuntu How to change spaw space or similar issue

@TheDogeOfTheInternet

This comment has been minimized.

Show comment
Hide comment
@TheDogeOfTheInternet

TheDogeOfTheInternet Aug 25, 2017

How do you do this on Windows?

TheDogeOfTheInternet commented Aug 25, 2017

How do you do this on Windows?

@Srinivasb0

This comment has been minimized.

Show comment
Hide comment
@Srinivasb0

Srinivasb0 Aug 31, 2017

Re install the boost package in case of CMake Error with Boost not found
sudo apt-get install libboost-all-dev

Srinivasb0 commented Aug 31, 2017

Re install the boost package in case of CMake Error with Boost not found
sudo apt-get install libboost-all-dev

@limsan

This comment has been minimized.

Show comment
Hide comment
@limsan

limsan Sep 15, 2017

Strange, freeze after some point.
I use anaconda with python=3.5.3 on windows 10
successfully compiled the previous steps using CUDA.
python setup.py install --yes USE_AVX_INSTRUCTIONS --yes DLIB_USE_CUDA
compiler msvc 2017
...
rectangles.cpp
object_detection.cpp
shape_predictor.cpp
correlation_tracker.cpp
face_recognition.cpp

stopped here, no errors or warning,

I tried with pip install face_recognition
, but at
Running setup.py bdist_wheel for dlib ... -
it also stopped, no errors nor warning

limsan commented Sep 15, 2017

Strange, freeze after some point.
I use anaconda with python=3.5.3 on windows 10
successfully compiled the previous steps using CUDA.
python setup.py install --yes USE_AVX_INSTRUCTIONS --yes DLIB_USE_CUDA
compiler msvc 2017
...
rectangles.cpp
object_detection.cpp
shape_predictor.cpp
correlation_tracker.cpp
face_recognition.cpp

stopped here, no errors or warning,

I tried with pip install face_recognition
, but at
Running setup.py bdist_wheel for dlib ... -
it also stopped, no errors nor warning

@davisking

This comment has been minimized.

Show comment
Hide comment
@davisking

davisking Sep 17, 2017

These instructions aren't right. In particular, you don't need to do this to build the python binding:

cd dlib
mkdir build; cd build; cmake .. -DDLIB_USE_CUDA=0 -DUSE_AVX_INSTRUCTIONS=1; cmake --build .

That's unnecessary and unrelated to building the python API.

davisking commented Sep 17, 2017

These instructions aren't right. In particular, you don't need to do this to build the python binding:

cd dlib
mkdir build; cd build; cmake .. -DDLIB_USE_CUDA=0 -DUSE_AVX_INSTRUCTIONS=1; cmake --build .

That's unnecessary and unrelated to building the python API.

@ys198918

This comment has been minimized.

Show comment
Hide comment
@ys198918

ys198918 Sep 21, 2017

@mathslimin did you solve that problem,and how?plz

ys198918 commented Sep 21, 2017

@mathslimin did you solve that problem,and how?plz

@jcbloch

This comment has been minimized.

Show comment
Hide comment
@jcbloch

jcbloch Oct 7, 2017

this fails on Mac OS X 10.12.6 (and setup.py will then fail)

$ brew install boost-python --with-python3 --without-python ==> Installing dependencies for boost-python: boost ==> Installing boost-python dependency: boost ==> Downloading https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.bz2 ######################################################################## 100.0% ==> ./bootstrap.sh --prefix=/usr/local/Cellar/boost/1.65.1 --libdir=/usr/local/Cellar/boost/1.65.1/lib --without-icu --without-libraries=python,mpi ==> ./b2 headers ==> ./b2 --prefix=/usr/local/Cellar/boost/1.65.1 --libdir=/usr/local/Cellar/boost/1.65.1/lib -d2 -j8 --layout=tagged --user-config=user-config.jam -sNO_LZMA=1 install threadi /usr/local/Cellar/boost/1.65.1: 12,681 files, 432.1MB, built in 12 minutes 24 seconds ==> Installing boost-python --without-python --with-python3 ==> Downloading https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.bz2 ######################################################################## 100.0% Error: boost was built in C++11 mode so boost-python must be built with --c++11.

instead, install just boost first, then boost-python:

$ brew install boost
$ brew install boost-python --with-python3 --without-python

and follow rest of directions above...

jcbloch commented Oct 7, 2017

this fails on Mac OS X 10.12.6 (and setup.py will then fail)

$ brew install boost-python --with-python3 --without-python ==> Installing dependencies for boost-python: boost ==> Installing boost-python dependency: boost ==> Downloading https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.bz2 ######################################################################## 100.0% ==> ./bootstrap.sh --prefix=/usr/local/Cellar/boost/1.65.1 --libdir=/usr/local/Cellar/boost/1.65.1/lib --without-icu --without-libraries=python,mpi ==> ./b2 headers ==> ./b2 --prefix=/usr/local/Cellar/boost/1.65.1 --libdir=/usr/local/Cellar/boost/1.65.1/lib -d2 -j8 --layout=tagged --user-config=user-config.jam -sNO_LZMA=1 install threadi /usr/local/Cellar/boost/1.65.1: 12,681 files, 432.1MB, built in 12 minutes 24 seconds ==> Installing boost-python --without-python --with-python3 ==> Downloading https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.bz2 ######################################################################## 100.0% Error: boost was built in C++11 mode so boost-python must be built with --c++11.

instead, install just boost first, then boost-python:

$ brew install boost
$ brew install boost-python --with-python3 --without-python

and follow rest of directions above...

@noblekoshy

This comment has been minimized.

Show comment
Hide comment
@noblekoshy

noblekoshy Oct 9, 2017

does it matter where clone the directory

git clone https://github.com/davisking/dlib.git

Can I clone it into my home directory?

noblekoshy commented Oct 9, 2017

does it matter where clone the directory

git clone https://github.com/davisking/dlib.git

Can I clone it into my home directory?

@liwg1995

This comment has been minimized.

Show comment
Hide comment
@liwg1995

liwg1995 Oct 12, 2017

[ 86%] Built target dlib
Scanning dependencies of target dlib_
[ 87%] Building CXX object CMakeFiles/dlib_.dir/src/dlib.cpp.o
In file included from /usr/include/boost/python/detail/prefix.hpp:13:0,
                 from /usr/include/boost/python/args.hpp:8,
                 from /usr/include/boost/python.hpp:11,
                 from /root/dlib/tools/python/src/dlib.cpp:4:
/usr/include/boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or directory
compilation terminated.
CMakeFiles/dlib_.dir/build.make:62: recipe for target 'CMakeFiles/dlib_.dir/src/dlib.cpp.o' failed
error: cmake build failed!
  • why?

liwg1995 commented Oct 12, 2017

[ 86%] Built target dlib
Scanning dependencies of target dlib_
[ 87%] Building CXX object CMakeFiles/dlib_.dir/src/dlib.cpp.o
In file included from /usr/include/boost/python/detail/prefix.hpp:13:0,
                 from /usr/include/boost/python/args.hpp:8,
                 from /usr/include/boost/python.hpp:11,
                 from /root/dlib/tools/python/src/dlib.cpp:4:
/usr/include/boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or directory
compilation terminated.
CMakeFiles/dlib_.dir/build.make:62: recipe for target 'CMakeFiles/dlib_.dir/src/dlib.cpp.o' failed
error: cmake build failed!
  • why?
@p59082644

This comment has been minimized.

Show comment
Hide comment
@p59082644

p59082644 Oct 16, 2017

you must use python 3.5 version

p59082644 commented Oct 16, 2017

you must use python 3.5 version

@adriangay

This comment has been minimized.

Show comment
Hide comment
@adriangay

adriangay Oct 18, 2017

as noted by @davisking, building dlib for Python is not required - just do
pip3 install face_recognition
if cmake is missing then just install it. On OSX:
brew install cmake

adriangay commented Oct 18, 2017

as noted by @davisking, building dlib for Python is not required - just do
pip3 install face_recognition
if cmake is missing then just install it. On OSX:
brew install cmake

@ksingh7

This comment has been minimized.

Show comment
Hide comment
@ksingh7

ksingh7 Oct 28, 2017

These steps worked for me on OSX flawlessly

$ brew install cmake
$ brew install boost-python
$ brew install opencv
$ pip install face_recognition
  • Verify
$ python
Python 2.7.14 |Anaconda, Inc.| (default, Oct  5 2017, 02:28:52)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import dlib
>>> import face_recognition
>>> import cv2
>>> exit ()

ksingh7 commented Oct 28, 2017

These steps worked for me on OSX flawlessly

$ brew install cmake
$ brew install boost-python
$ brew install opencv
$ pip install face_recognition
  • Verify
$ python
Python 2.7.14 |Anaconda, Inc.| (default, Oct  5 2017, 02:28:52)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import dlib
>>> import face_recognition
>>> import cv2
>>> exit ()
@sweetod

This comment has been minimized.

Show comment
Hide comment
@sweetod

sweetod Oct 30, 2017

Hi,
I'm using macOS and python3.5
I can compile, but finally I run import dlib, it shows error
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/dlib-19.7.99-py3.5-macosx-10.6-intel.egg/dlib/__init__.py", line 1, in <module> from .dlib import * ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/dlib-19.7.99-py3.5-macosx-10.6-intel.egg/dlib/dlib.so, 2): Library not loaded: @rpath/libmkl_rt.dylib Referenced from: /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/dlib-19.7.99-py3.5-macosx-10.6-intel.egg/dlib/dlib.so Reason: image not found
How can I deal with this?

sweetod commented Oct 30, 2017

Hi,
I'm using macOS and python3.5
I can compile, but finally I run import dlib, it shows error
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/dlib-19.7.99-py3.5-macosx-10.6-intel.egg/dlib/__init__.py", line 1, in <module> from .dlib import * ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/dlib-19.7.99-py3.5-macosx-10.6-intel.egg/dlib/dlib.so, 2): Library not loaded: @rpath/libmkl_rt.dylib Referenced from: /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/dlib-19.7.99-py3.5-macosx-10.6-intel.egg/dlib/dlib.so Reason: image not found
How can I deal with this?

@sweetod

This comment has been minimized.

Show comment
Hide comment
@sweetod

sweetod Oct 30, 2017

Well, it gets fine,
Seems since I cp /lib/libpython3.6m.dylib /lib/libpython3.6.dylib

sweetod commented Oct 30, 2017

Well, it gets fine,
Seems since I cp /lib/libpython3.6m.dylib /lib/libpython3.6.dylib

@fuzheng1998

This comment has been minimized.

Show comment
Hide comment
@fuzheng1998

fuzheng1998 Nov 13, 2017

on Mac OS , dlib can be installed directly via pip

fuzheng1998 commented Nov 13, 2017

on Mac OS , dlib can be installed directly via pip

@Sukrit-Mehta

This comment has been minimized.

Show comment
Hide comment
@Sukrit-Mehta

Sukrit-Mehta Nov 16, 2017

Hello everyone , can anyone help out in INSTALLING dlib on Ubuntu.
On writing the command: $ sudo apt-get install libboost-all-dev , I get the following ERRORS mentioned below:

Ign:1 http://archive.ubuntu.com/ubuntu xenial-security/main amd64 icu-devtools amd64 55.1-7ubuntu0.2
Ign:2 http://archive.ubuntu.com/ubuntu xenial-security/main amd64 libicu-dev amd64 55.1-7ubuntu0.2
Err:1 http://archive.ubuntu.com/ubuntu xenial-security/main amd64 icu-devtools amd64 55.1-7ubuntu0.2
404 Not Found [IP: 91.189.88.161 80]
Err:2 http://archive.ubuntu.com/ubuntu xenial-security/main amd64 libicu-dev amd64 55.1-7ubuntu0.2
404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/i/icu/icu-devtools_55.1-7ubuntu0.2_amd64.deb 404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/i/icu/libicu-dev_55.1-7ubuntu0.2_amd64.deb 404 Not Found [IP: 91.189.88.161 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Thanks in Advance :)

Sukrit-Mehta commented Nov 16, 2017

Hello everyone , can anyone help out in INSTALLING dlib on Ubuntu.
On writing the command: $ sudo apt-get install libboost-all-dev , I get the following ERRORS mentioned below:

Ign:1 http://archive.ubuntu.com/ubuntu xenial-security/main amd64 icu-devtools amd64 55.1-7ubuntu0.2
Ign:2 http://archive.ubuntu.com/ubuntu xenial-security/main amd64 libicu-dev amd64 55.1-7ubuntu0.2
Err:1 http://archive.ubuntu.com/ubuntu xenial-security/main amd64 icu-devtools amd64 55.1-7ubuntu0.2
404 Not Found [IP: 91.189.88.161 80]
Err:2 http://archive.ubuntu.com/ubuntu xenial-security/main amd64 libicu-dev amd64 55.1-7ubuntu0.2
404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/i/icu/icu-devtools_55.1-7ubuntu0.2_amd64.deb 404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/i/icu/libicu-dev_55.1-7ubuntu0.2_amd64.deb 404 Not Found [IP: 91.189.88.161 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Thanks in Advance :)

@CrazyNeil

This comment has been minimized.

Show comment
Hide comment
@CrazyNeil

CrazyNeil Nov 26, 2017

since i start Build and install the Python extensions from the command:

python3 setup.py install --yes USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA

the process stop at 88% as bellow:

[ 88%] Building CXX object CMakeFiles/dlib_.dir/src/svm_c_trainer.cpp.o

and the ssh disconnect from the server
I tried serval times but still the same problem

CrazyNeil commented Nov 26, 2017

since i start Build and install the Python extensions from the command:

python3 setup.py install --yes USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA

the process stop at 88% as bellow:

[ 88%] Building CXX object CMakeFiles/dlib_.dir/src/svm_c_trainer.cpp.o

and the ssh disconnect from the server
I tried serval times but still the same problem

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Dec 27, 2017

how can i fix this problem?

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import dlib
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/dlib-19.8.0-py3.6-macosx-10.6-intel.egg/dlib/__init__.py", line 1, in <module>
    from .dlib import *
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/dlib-19.8.0-py3.6-macosx-10.6-intel.egg/dlib/dlib.so, 2): Symbol not found: _PyClass_Type
  Referenced from: /usr/local/lib/libboost_python.dylib
  Expected in: flat namespace
 in /usr/local/lib/libboost_python.dylib

ghost commented Dec 27, 2017

how can i fix this problem?

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import dlib
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/dlib-19.8.0-py3.6-macosx-10.6-intel.egg/dlib/__init__.py", line 1, in <module>
    from .dlib import *
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/dlib-19.8.0-py3.6-macosx-10.6-intel.egg/dlib/dlib.so, 2): Symbol not found: _PyClass_Type
  Referenced from: /usr/local/lib/libboost_python.dylib
  Expected in: flat namespace
 in /usr/local/lib/libboost_python.dylib
@CRonaldo1997

This comment has been minimized.

Show comment
Hide comment
@CRonaldo1997

CRonaldo1997 Dec 27, 2017

it works for me, thanks~

CRonaldo1997 commented Dec 27, 2017

it works for me, thanks~

@imperator-maximus

This comment has been minimized.

Show comment
Hide comment
@imperator-maximus

imperator-maximus Jan 10, 2018

On Mac OSX I am getting the following error:

Traceback (most recent call last):
File "", line 1, in
File "/Users/imperator/anaconda/lib/python3.5/site-packages/face_recognition/init.py", line 7, in
from .api import load_image_file, face_locations, batch_face_locations, face_landmarks, face_encodings, compare_faces, face_distance
File "/Users/imperator/anaconda/lib/python3.5/site-packages/face_recognition/api.py", line 21, in
cnn_face_detector = dlib.cnn_face_detection_model_v1(cnn_face_detection_model)
AttributeError: module 'dlib' has no attribute 'cnn_face_detection_model_v1'

with
pip show dlib
Name: dlib
Version: 19.8.99
Summary: A toolkit for making real world machine learning and data analysis applications
Home-page: https://github.com/davisking/dlib
Author: Davis King
Author-email: davis@dlib.net
License: Boost Software License
Location: /Users/imperator/anaconda/lib/python3.5/site-packages/dlib-19.8.99-py3.5-macosx-10.6-x86_64.egg

how can I fix this?

imperator-maximus commented Jan 10, 2018

On Mac OSX I am getting the following error:

Traceback (most recent call last):
File "", line 1, in
File "/Users/imperator/anaconda/lib/python3.5/site-packages/face_recognition/init.py", line 7, in
from .api import load_image_file, face_locations, batch_face_locations, face_landmarks, face_encodings, compare_faces, face_distance
File "/Users/imperator/anaconda/lib/python3.5/site-packages/face_recognition/api.py", line 21, in
cnn_face_detector = dlib.cnn_face_detection_model_v1(cnn_face_detection_model)
AttributeError: module 'dlib' has no attribute 'cnn_face_detection_model_v1'

with
pip show dlib
Name: dlib
Version: 19.8.99
Summary: A toolkit for making real world machine learning and data analysis applications
Home-page: https://github.com/davisking/dlib
Author: Davis King
Author-email: davis@dlib.net
License: Boost Software License
Location: /Users/imperator/anaconda/lib/python3.5/site-packages/dlib-19.8.99-py3.5-macosx-10.6-x86_64.egg

how can I fix this?

@christiansievers

This comment has been minimized.

Show comment
Hide comment
@christiansievers

christiansievers Jan 12, 2018

using Ubuntu 16.04 with CUDA 9.0, seems it worked OK to install it with CUDA support, which is amazing since I'm fairly new to this. So I did
mkdir build; cd build; cmake .. -DDLIB_USE_CUDA=1 -DUSE_AVX_INSTRUCTIONS=1; cmake --build .

binding it to python3 with CUDA support fell back to CPU-only, so I had to first install cuDNN http://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html

and then accordingly python3 setup.py install --yes USE_AVX_INSTRUCTIONS --yes DLIB_USE_CUDA

christiansievers commented Jan 12, 2018

using Ubuntu 16.04 with CUDA 9.0, seems it worked OK to install it with CUDA support, which is amazing since I'm fairly new to this. So I did
mkdir build; cd build; cmake .. -DDLIB_USE_CUDA=1 -DUSE_AVX_INSTRUCTIONS=1; cmake --build .

binding it to python3 with CUDA support fell back to CPU-only, so I had to first install cuDNN http://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html

and then accordingly python3 setup.py install --yes USE_AVX_INSTRUCTIONS --yes DLIB_USE_CUDA

@edgarrt

This comment has been minimized.

Show comment
Hide comment
@edgarrt

edgarrt Jan 14, 2018

Worked on Ubuntu 16.04 for me, just needed to 'sudo' last command.

edgarrt commented Jan 14, 2018

Worked on Ubuntu 16.04 for me, just needed to 'sudo' last command.

@MaoXianXin

This comment has been minimized.

Show comment
Hide comment
@MaoXianXin

MaoXianXin Jan 15, 2018

you'd better have checked packages in Dockerfile, then installed. It just work.

MaoXianXin commented Jan 15, 2018

you'd better have checked packages in Dockerfile, then installed. It just work.

@foocp

This comment has been minimized.

Show comment
Hide comment
@foocp

foocp Jan 17, 2018

on Mac, do a brew update first, and make sure to clean up all problems that brew doctor might come up with. It failed on mine first because I had an outdated Xcode, and had to download a not totally new version (I'm refusing to run Sierra) from Apple Developer.

foocp commented Jan 17, 2018

on Mac, do a brew update first, and make sure to clean up all problems that brew doctor might come up with. It failed on mine first because I had an outdated Xcode, and had to download a not totally new version (I'm refusing to run Sierra) from Apple Developer.

@edgarrt

This comment has been minimized.

Show comment
Hide comment
@edgarrt

edgarrt Jan 19, 2018

added my gtx 1050 and got it running using 16.04 with CUDA 9.1, installed fine.
Did the same as @christiansievers to build dlib

edgarrt commented Jan 19, 2018

added my gtx 1050 and got it running using 16.04 with CUDA 9.1, installed fine.
Did the same as @christiansievers to build dlib

@CoXier

This comment has been minimized.

Show comment
Hide comment
@CoXier

CoXier Jan 19, 2018

git clone git@github.com:davisking/dlib.git

may be faster.

CoXier commented Jan 19, 2018

git clone git@github.com:davisking/dlib.git

may be faster.

@Jerameel

This comment has been minimized.

Show comment
Hide comment
@Jerameel

Jerameel Feb 5, 2018

for fedora systems, install the following before proceeding with dlib

sudo dnf install python3-devel
sudo dnf install cmake
sudo dnf install boost-devel
sudo dnf group install "C Development Tools and Libraries"
sudo dnf install @development-tools
sudo dnf install GraphicsMagick-devel-1.3.26-10.fc27.x86_64 
sudo dnf install atlas-devel-3.10.3-1.fc27.x86_64 

Jerameel commented Feb 5, 2018

for fedora systems, install the following before proceeding with dlib

sudo dnf install python3-devel
sudo dnf install cmake
sudo dnf install boost-devel
sudo dnf group install "C Development Tools and Libraries"
sudo dnf install @development-tools
sudo dnf install GraphicsMagick-devel-1.3.26-10.fc27.x86_64 
sudo dnf install atlas-devel-3.10.3-1.fc27.x86_64 
@martin3000

This comment has been minimized.

Show comment
Hide comment
@martin3000

martin3000 Feb 11, 2018

In ubuntu just do: sudo apt install libdlib18

martin3000 commented Feb 11, 2018

In ubuntu just do: sudo apt install libdlib18

@janegzy

This comment has been minimized.

Show comment
Hide comment
@janegzy

janegzy Mar 20, 2018

Hello! Thank you for the sharing.
When I typed in "python3 setup.py install --yes USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA" in the terminal, I got the following message, could you please help me solve the problem?
"python3 setup.py install --yes USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA
/Library/Frameworks/Python.framework/Versions/3.6/Resources/Python.app/Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such file or directory"

Thank you!

janegzy commented Mar 20, 2018

Hello! Thank you for the sharing.
When I typed in "python3 setup.py install --yes USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA" in the terminal, I got the following message, could you please help me solve the problem?
"python3 setup.py install --yes USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA
/Library/Frameworks/Python.framework/Versions/3.6/Resources/Python.app/Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such file or directory"

Thank you!

@springwcs

This comment has been minimized.

Show comment
Hide comment
@springwcs

springwcs Apr 28, 2018

In ubuntu16.04, i installed cuda8.0 and cudnn,python3.6(anacoda3) and opencv3.4, when i run face_recognation with gpu, but error happened as follow:
Ai_face_recognition.face_lib: ERROR: 20180427 23:23:18: Error while calling cudaGetDevice(&the_device_id) in file /home/ckt/work/tools/dlib-19.10/dlib/dnn/gpu_data.cpp:178. code: 3, reason: initialization error
Traceback (most recent call last):
File "/home/ckt/work/code/code/AI/faster/smartcv_ai/ai_face_recognition/face_lib.py", line 22, in init
face_encoding = face_recognition.face_encodings(rgb_img)[0]
File "/home/ckt/anaconda3/lib/python3.6/site-packages/face_recognition-1.2.2-py3.6.egg/face_recognition/api.py", line 200, in face_encodings
return [np.array(face_encoder.compute_face_descriptor(face_image, raw_landmark_set, num_jitters)) for raw_landmark_set in raw_landmarks]
File "/home/ckt/anaconda3/lib/python3.6/site-packages/face_recognition-1.2.2-py3.6.egg/face_recognition/api.py", line 200, in
return [np.array(face_encoder.compute_face_descriptor(face_image, raw_landmark_set, num_jitters)) for raw_landmark_set in raw_landmarks]
RuntimeError: Error while calling cudaGetDevice(&the_device_id) in file /home/ckt/work/tools/dlib-19.10/dlib/dnn/gpu_data.cpp:178. code: 3, reason: initialization error

how can i fix it? pls help me.

springwcs commented Apr 28, 2018

In ubuntu16.04, i installed cuda8.0 and cudnn,python3.6(anacoda3) and opencv3.4, when i run face_recognation with gpu, but error happened as follow:
Ai_face_recognition.face_lib: ERROR: 20180427 23:23:18: Error while calling cudaGetDevice(&the_device_id) in file /home/ckt/work/tools/dlib-19.10/dlib/dnn/gpu_data.cpp:178. code: 3, reason: initialization error
Traceback (most recent call last):
File "/home/ckt/work/code/code/AI/faster/smartcv_ai/ai_face_recognition/face_lib.py", line 22, in init
face_encoding = face_recognition.face_encodings(rgb_img)[0]
File "/home/ckt/anaconda3/lib/python3.6/site-packages/face_recognition-1.2.2-py3.6.egg/face_recognition/api.py", line 200, in face_encodings
return [np.array(face_encoder.compute_face_descriptor(face_image, raw_landmark_set, num_jitters)) for raw_landmark_set in raw_landmarks]
File "/home/ckt/anaconda3/lib/python3.6/site-packages/face_recognition-1.2.2-py3.6.egg/face_recognition/api.py", line 200, in
return [np.array(face_encoder.compute_face_descriptor(face_image, raw_landmark_set, num_jitters)) for raw_landmark_set in raw_landmarks]
RuntimeError: Error while calling cudaGetDevice(&the_device_id) in file /home/ckt/work/tools/dlib-19.10/dlib/dnn/gpu_data.cpp:178. code: 3, reason: initialization error

how can i fix it? pls help me.

@kedar2594

This comment has been minimized.

Show comment
Hide comment
@kedar2594

kedar2594 May 5, 2018

  • face_recognition version:1.2.2
  • Python version:3.5.2
  • Operating System:windows 10

Running code in Anaconda Command Prompt

I have installed Dlib and Face recognition, Image detection and recognition will give accurate result, problem will arise when groping similar face to another folder.

Traceback (most recent call last):
File "all_modfied.py", line 49, in
copyImage(recognizedFaceFolder, sourceFaceImagePath, recognizedImageFullPath)
File "all_modfied.py", line 25, in copyImage
os.mkdir(recognizedFaceFolder, mode)
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect:'

os.mkdir function is not creating directory,

kedar2594 commented May 5, 2018

  • face_recognition version:1.2.2
  • Python version:3.5.2
  • Operating System:windows 10

Running code in Anaconda Command Prompt

I have installed Dlib and Face recognition, Image detection and recognition will give accurate result, problem will arise when groping similar face to another folder.

Traceback (most recent call last):
File "all_modfied.py", line 49, in
copyImage(recognizedFaceFolder, sourceFaceImagePath, recognizedImageFullPath)
File "all_modfied.py", line 25, in copyImage
os.mkdir(recognizedFaceFolder, mode)
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect:'

os.mkdir function is not creating directory,

@elahia

This comment has been minimized.

Show comment
Hide comment
@elahia

elahia May 30, 2018

thank you, this really helped me,

Good luck

elahia commented May 30, 2018

thank you, this really helped me,

Good luck

@hiteshn97

This comment has been minimized.

Show comment
Hide comment
@hiteshn97

hiteshn97 Jun 14, 2018

On this line :
python3 setup.py install --yes USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA

I am getting the following error :
Traceback (most recent call last):
File "setup.py", line 39, in
from distutils import log
ImportError: cannot import name 'log'

Can you please tell how to correct it ?

hiteshn97 commented Jun 14, 2018

On this line :
python3 setup.py install --yes USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA

I am getting the following error :
Traceback (most recent call last):
File "setup.py", line 39, in
from distutils import log
ImportError: cannot import name 'log'

Can you please tell how to correct it ?

@tallescs

This comment has been minimized.

Show comment
Hide comment
@tallescs

tallescs Jul 17, 2018

@hiteshn97 the log is from python distutils, you can import install the package with the command
sudo apt-get install python-distutils

tallescs commented Jul 17, 2018

@hiteshn97 the log is from python distutils, you can import install the package with the command
sudo apt-get install python-distutils

@piyushmanglani08

This comment has been minimized.

Show comment
Hide comment
@piyushmanglani08

piyushmanglani08 Aug 1, 2018

mkdir build; cd build; cmake .. -DDLIB_USE_CUDA=0 -DUSE_AVX_INSTRUCTIONS=1; cmake --build .
CMake Error: The source directory "/home/piyush/dlib/build" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
Error: could not load cache

what should i do??

piyushmanglani08 commented Aug 1, 2018

mkdir build; cd build; cmake .. -DDLIB_USE_CUDA=0 -DUSE_AVX_INSTRUCTIONS=1; cmake --build .
CMake Error: The source directory "/home/piyush/dlib/build" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
Error: could not load cache

what should i do??

@akhilgupta0221

This comment has been minimized.

Show comment
Hide comment
@akhilgupta0221

akhilgupta0221 Aug 24, 2018

Getting the Error on Ubuntu when we execute the below command

python setup.py install --yes USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA

In file included from /home/tuple/facerecognition/dlib/dlib/../dlib/algs.h:111:0,
from /home/tuple/facerecognition/dlib/dlib/../dlib/serialize.h:142,
from /home/tuple/facerecognition/dlib/dlib/../dlib/python/pybind_utils.h:9,
from /home/tuple/facerecognition/dlib/dlib/../dlib/python.h:6,
from /home/tuple/facerecognition/dlib/tools/python/src/opaque_types.h:6,
from /home/tuple/facerecognition/dlib/tools/python/src/image3.cpp:3:
/home/tuple/facerecognition/dlib/dlib/../dlib/data_io/../image_saver/../sliding_buffer/sliding_buffer_kernel_c.h: In member function ‘typename sb_base::type& dlib::sliding_buffer_kernel_c<sb_base>::element()’:
/home/tuple/facerecognition/dlib/dlib/../dlib/data_io/../image_saver/../sliding_buffer/sliding_buffer_kernel_c.h:211:13: internal compiler error: Segmentation fault
);
^
/home/tuple/facerecognition/dlib/dlib/../dlib/assert.h:157:47: note: in definition of macro ‘DLIB_WORKAROUND_VISUAL_STUDIO_BUGS’
#define DLIB_WORKAROUND_VISUAL_STUDIO_BUGS(x) x
^
Please submit a full bug report,
with preprocessed source if appropriate.
See file:///usr/share/doc/gcc-5/README.Bugs for instructions.
CMakeFiles/dlib_python.dir/build.make:374: recipe for target 'CMakeFiles/dlib_python.dir/src/image3.cpp.o' failed
make[2]: *** [CMakeFiles/dlib_python.dir/src/image3.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....

/home/tuple/facerecognition/dlib/tools/python/src/image2.cpp:139:24: required from ‘pybind11::list py_extract_image_chips(const dlib::numpy_image<pixel_type>&, const pybind11::list&) [with T = dlib::rgb_pixel]’
/home/tuple/facerecognition/dlib/tools/python/src/image2.cpp:434:9: required from here
/home/tuple/facerecognition/dlib/dlib/../dlib/image_transforms/interpolation.h:315:25: internal compiler error: Segmentation fault
assign_pixel(temp.red, red);
^
Please submit a full bug report,
with preprocessed source if appropriate.
See file:///usr/share/doc/gcc-5/README.Bugs for instructions.
CMakeFiles/dlib_python.dir/build.make:350: recipe for target 'CMakeFiles/dlib_python.dir/src/image2.cpp.o' failed
make[2]: *** [CMakeFiles/dlib_python.dir/src/image2.cpp.o] Error 1
In file included from /home/tuple/facerecognition/dlib/dlib/../dlib/python/pybind_utils.h:6:0,
from /home/tuple/facerecognition/dlib/dlib/../dlib/python.h:6,
from /home/tuple/facerecognition/dlib/tools/python/src/opaque_types.h:6,
from /home/tuple/facerecognition/dlib/tools/python/src/svm_rank_trainer.cpp:4:
/home/tuple/facerecognition/dlib/dlib/external/pybind11/include/pybind11/pybind11.h: In static member function ‘static PyObject* pybind11::cpp_function::dispatcher(PyObject*, PyObject*, PyObject*)’:
/home/tuple/facerecognition/dlib/dlib/external/pybind11/include/pybind11/pybind11.h:779:5: internal compiler error: Segmentation fault
}
^

akhilgupta0221 commented Aug 24, 2018

Getting the Error on Ubuntu when we execute the below command

python setup.py install --yes USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA

In file included from /home/tuple/facerecognition/dlib/dlib/../dlib/algs.h:111:0,
from /home/tuple/facerecognition/dlib/dlib/../dlib/serialize.h:142,
from /home/tuple/facerecognition/dlib/dlib/../dlib/python/pybind_utils.h:9,
from /home/tuple/facerecognition/dlib/dlib/../dlib/python.h:6,
from /home/tuple/facerecognition/dlib/tools/python/src/opaque_types.h:6,
from /home/tuple/facerecognition/dlib/tools/python/src/image3.cpp:3:
/home/tuple/facerecognition/dlib/dlib/../dlib/data_io/../image_saver/../sliding_buffer/sliding_buffer_kernel_c.h: In member function ‘typename sb_base::type& dlib::sliding_buffer_kernel_c<sb_base>::element()’:
/home/tuple/facerecognition/dlib/dlib/../dlib/data_io/../image_saver/../sliding_buffer/sliding_buffer_kernel_c.h:211:13: internal compiler error: Segmentation fault
);
^
/home/tuple/facerecognition/dlib/dlib/../dlib/assert.h:157:47: note: in definition of macro ‘DLIB_WORKAROUND_VISUAL_STUDIO_BUGS’
#define DLIB_WORKAROUND_VISUAL_STUDIO_BUGS(x) x
^
Please submit a full bug report,
with preprocessed source if appropriate.
See file:///usr/share/doc/gcc-5/README.Bugs for instructions.
CMakeFiles/dlib_python.dir/build.make:374: recipe for target 'CMakeFiles/dlib_python.dir/src/image3.cpp.o' failed
make[2]: *** [CMakeFiles/dlib_python.dir/src/image3.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....

/home/tuple/facerecognition/dlib/tools/python/src/image2.cpp:139:24: required from ‘pybind11::list py_extract_image_chips(const dlib::numpy_image<pixel_type>&, const pybind11::list&) [with T = dlib::rgb_pixel]’
/home/tuple/facerecognition/dlib/tools/python/src/image2.cpp:434:9: required from here
/home/tuple/facerecognition/dlib/dlib/../dlib/image_transforms/interpolation.h:315:25: internal compiler error: Segmentation fault
assign_pixel(temp.red, red);
^
Please submit a full bug report,
with preprocessed source if appropriate.
See file:///usr/share/doc/gcc-5/README.Bugs for instructions.
CMakeFiles/dlib_python.dir/build.make:350: recipe for target 'CMakeFiles/dlib_python.dir/src/image2.cpp.o' failed
make[2]: *** [CMakeFiles/dlib_python.dir/src/image2.cpp.o] Error 1
In file included from /home/tuple/facerecognition/dlib/dlib/../dlib/python/pybind_utils.h:6:0,
from /home/tuple/facerecognition/dlib/dlib/../dlib/python.h:6,
from /home/tuple/facerecognition/dlib/tools/python/src/opaque_types.h:6,
from /home/tuple/facerecognition/dlib/tools/python/src/svm_rank_trainer.cpp:4:
/home/tuple/facerecognition/dlib/dlib/external/pybind11/include/pybind11/pybind11.h: In static member function ‘static PyObject* pybind11::cpp_function::dispatcher(PyObject*, PyObject*, PyObject*)’:
/home/tuple/facerecognition/dlib/dlib/external/pybind11/include/pybind11/pybind11.h:779:5: internal compiler error: Segmentation fault
}
^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment