dlib icon indicating copy to clipboard operation
dlib copied to clipboard

Unable to install dlib by pip on Brew Python or to build from source (mac 10.12)

Open gojira opened this issue 9 years ago • 11 comments

For pip install dlib, the errors are below

Collecting dlib Using cached dlib-19.1.0.tar.gz Building wheels for collected packages: dlib Running setup.py bdist_wheel for dlib ... error Complete output from command /usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;file='/private/var/folders/j0/0zny89t96fn1zhn4r3bzjmk00000gn/T/pip-build-BrwHgk/dlib/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d /var/folders/j0/0zny89t96fn1zhn4r3bzjmk00000gn/T/tmpw7DHX3pip-wheel- --python-tag cp27: running bdist_wheel running build Detected Python architecture: 64bit Detected platform: darwin Configuring cmake ... -- The C compiler identification is AppleClang 8.0.0.8000042 -- The CXX compiler identification is AppleClang 8.0.0.8000042 -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Warning at /usr/local/Cellar/cmake/3.7.1/share/cmake/Modules/FindBoost.cmake:744 (message): Imported targets not available for Boost version 106300 Call Stack (most recent call first): /usr/local/Cellar/cmake/3.7.1/share/cmake/Modules/FindBoost.cmake:848 (_Boost_COMPONENT_DEPENDENCIES) /usr/local/Cellar/cmake/3.7.1/share/cmake/Modules/FindBoost.cmake:1435 (_Boost_MISSING_DEPENDENCIES) /private/var/folders/j0/0zny89t96fn1zhn4r3bzjmk00000gn/T/pip-build-BrwHgk/dlib/dlib/cmake_utils/add_python_module:73 (FIND_PACKAGE) CMakeLists.txt:6 (include) -- Boost version: 1.63.0 -- Found the following Boost libraries: -- python -- Found PythonLibs: /usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib (found suitable version "2.7.13", minimum required is "2.6") -- USING BOOST_LIBS: /usr/local/lib/libboost_python-mt.dylib -- USING PYTHON_LIBS: /usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib -- C++11 activated. -- Enabling SSE4 instructions -- Looking for pthread.h -- Looking for pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - found -- Found Threads: TRUE -- Looking for png_create_read_struct -- Looking for png_create_read_struct - found -- Looking for jpeg_read_header -- Looking for jpeg_read_header - found -- Searching for BLAS and LAPACK -- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.29.1") -- Checking for module 'cblas' -- No package 'cblas' found -- Checking for module 'lapack' -- No package 'lapack' found -- Looking for sys/types.h -- Looking for sys/types.h - found -- Looking for stdint.h -- Looking for stdint.h - found -- Looking for stddef.h -- Looking for stddef.h - found -- Check size of void* -- Check size of void* - done -- Found LAPACK library -- Found CBLAS library -- Looking for cblas_ddot -- Looking for cblas_ddot - found -- Found CUDA: /usr/local/cuda (found suitable version "8.0", minimum required is "7.5") -- Looking for cuDNN install... CMake Error at /private/var/folders/j0/0zny89t96fn1zhn4r3bzjmk00000gn/T/pip-build-BrwHgk/dlib/dlib/cmake_utils/test_for_cudnn/find_cudnn.txt:10 (get_filename_component): get_filename_component unknown component /usr/local/cuda/lib/libcublas_device.a Call Stack (most recent call first): /private/var/folders/j0/0zny89t96fn1zhn4r3bzjmk00000gn/T/pip-build-BrwHgk/dlib/dlib/CMakeLists.txt:462 (include) -- Building a CUDA test project to see if your compiler is compatible with CUDA... -- Checking if you have the right version of cuDNN installed. CMake Error at /private/var/folders/j0/0zny89t96fn1zhn4r3bzjmk00000gn/T/pip-build-BrwHgk/dlib/dlib/cmake_utils/test_for_cudnn/find_cudnn.txt:10 (get_filename_component): error: cmake configuration failed!


Failed building wheel for dlib Running setup.py clean for dlib Failed to build dlib Installing collected packages: dlib Running setup.py install for dlib ... error Complete output from command /usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;file='/private/var/folders/j0/0zny89t96fn1zhn4r3bzjmk00000gn/T/pip-build-BrwHgk/dlib/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /var/folders/j0/0zny89t96fn1zhn4r3bzjmk00000gn/T/pip-Q9g81O-record/install-record.txt --single-version-externally-managed --compile: running install running build Detected Python architecture: 64bit Detected platform: darwin Removing build directory /private/var/folders/j0/0zny89t96fn1zhn4r3bzjmk00000gn/T/pip-build-BrwHgk/dlib/./tools/python/build Configuring cmake ... -- The C compiler identification is AppleClang 8.0.0.8000042 -- The CXX compiler identification is AppleClang 8.0.0.8000042 -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Warning at /usr/local/Cellar/cmake/3.7.1/share/cmake/Modules/FindBoost.cmake:744 (message): Imported targets not available for Boost version 106300 Call Stack (most recent call first): /usr/local/Cellar/cmake/3.7.1/share/cmake/Modules/FindBoost.cmake:848 (_Boost_COMPONENT_DEPENDENCIES) /usr/local/Cellar/cmake/3.7.1/share/cmake/Modules/FindBoost.cmake:1435 (_Boost_MISSING_DEPENDENCIES) /private/var/folders/j0/0zny89t96fn1zhn4r3bzjmk00000gn/T/pip-build-BrwHgk/dlib/dlib/cmake_utils/add_python_module:73 (FIND_PACKAGE) CMakeLists.txt:6 (include) -- Boost version: 1.63.0 -- Found the following Boost libraries: -- python -- Found PythonLibs: /usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib (found suitable version "2.7.13", minimum required is "2.6") -- USING BOOST_LIBS: /usr/local/lib/libboost_python-mt.dylib -- USING PYTHON_LIBS: /usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib -- C++11 activated. -- Enabling SSE4 instructions -- Looking for pthread.h -- Looking for pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - found -- Found Threads: TRUE -- Looking for png_create_read_struct -- Looking for png_create_read_struct - found -- Looking for jpeg_read_header -- Looking for jpeg_read_header - found -- Searching for BLAS and LAPACK -- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.29.1") -- Checking for module 'cblas' -- No package 'cblas' found -- Checking for module 'lapack' -- No package 'lapack' found -- Looking for sys/types.h -- Looking for sys/types.h - found -- Looking for stdint.h -- Looking for stdint.h - found -- Looking for stddef.h -- Looking for stddef.h - found -- Check size of void* -- Check size of void* - done -- Found LAPACK library -- Found CBLAS library -- Looking for cblas_ddot -- Looking for cblas_ddot - found -- Found CUDA: /usr/local/cuda (found suitable version "8.0", minimum required is "7.5") -- Looking for cuDNN install... CMake Error at /private/var/folders/j0/0zny89t96fn1zhn4r3bzjmk00000gn/T/pip-build-BrwHgk/dlib/dlib/cmake_utils/test_for_cudnn/find_cudnn.txt:10 (get_filename_component): get_filename_component unknown component /usr/local/cuda/lib/libcublas_device.a Call Stack (most recent call first): /private/var/folders/j0/0zny89t96fn1zhn4r3bzjmk00000gn/T/pip-build-BrwHgk/dlib/dlib/CMakeLists.txt:462 (include) -- Building a CUDA test project to see if your compiler is compatible with CUDA... -- Checking if you have the right version of cuDNN installed. CMake Error at /private/var/folders/j0/0zny89t96fn1zhn4r3bzjmk00000gn/T/pip-build-BrwHgk/dlib/dlib/cmake_utils/test_for_cudnn/find_cudnn.txt:10 (get_filename_component): error: cmake configuration failed!

----------------------------------------

Command "/usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;file='/private/var/folders/j0/0zny89t96fn1zhn4r3bzjmk00000gn/T/pip-build-BrwHgk/dlib/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /var/folders/j0/0zny89t96fn1zhn4r3bzjmk00000gn/T/pip-Q9g81O-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/j0/0zny89t96fn1zhn4r3bzjmk00000gn/T/pip-build-BrwHgk/dlib/

At first I got an error about CMAKE_PREFIX_PATH so I set it to /usr/local/cuda but I still the same error

CUDA & CUDNN certainly both exist in /usr/local/cuda/lib

libcublas.8.0.dylib@ libcufftw.dylib@ libnppi.8.0.dylib@ libnppif_static.a@ libnpps.dylib@ libcublas.dylib@ libcufftw_static.a@ libnppi.dylib@ libnppig.8.0.dylib@ libnpps_static.a@ libcublas_device.a@ libcuinj.8.0.dylib@ libnppi_static.a@ libnppig.dylib@ libnvToolsExt.1.dylib@ libcublas_static.a@ libcuinj.dylib@ libnppial.8.0.dylib@ libnppig_static.a@ libnvToolsExt.dylib@ libcuda.1.dylib@ libculibos.a@ libnppial.dylib@ libnppim.8.0.dylib@ libnvblas.8.0.dylib@ libcuda.dylib* libcurand.8.0.dylib@ libnppial_static.a@ libnppim.dylib@ libnvblas.dylib@ libcudadevrt.a@ libcurand.dylib@ libnppicc.8.0.dylib@ libnppim_static.a@ libnvgraph.8.0.dylib@ libcudart.8.0.dylib@ libcurand_static.a@ libnppicc.dylib@ libnppist.8.0.dylib@ libnvgraph.dylib@ libcudart.dylib@ libcusolver.8.0.dylib@ libnppicc_static.a@ libnppist.dylib@ libnvgraph_static.a@ libcudart_static.a@ libcusolver.dylib@ libnppicom.8.0.dylib@ libnppist_static.a@ libnvrtc-builtins.8.0.dylib@ libcudnn.5.dylib@ libcusolver_static.a@ libnppicom.dylib@ libnppisu.8.0.dylib@ libnvrtc-builtins.dylib@ libcudnn.dylib@ libcusparse.8.0.dylib@ libnppicom_static.a@ libnppisu.dylib@ libnvrtc.8.0.dylib@ libcudnn_static.a@ libcusparse.dylib@ libnppidei.8.0.dylib@ libnppisu_static.a@ libnvrtc.dylib@ libcufft.8.0.dylib@ libcusparse_static.a@ libnppidei.dylib@ libnppitc.8.0.dylib@ stubs@ libcufft.dylib@ libnppc.8.0.dylib@ libnppidei_static.a@ libnppitc.dylib@ libcufft_static.a@ libnppc.dylib@ libnppif.8.0.dylib@ libnppitc_static.a@ libcufftw.8.0.dylib@ libnppc_static.a@ libnppif.dylib@ libnpps.8.0.dylib@

For build from source, the error is also around CUDA/CUDNN but it fails in nvcc

[ 0%] Building NVCC (Device) object dlib_build/CMakeFiles/dlib.dir/dnn/dlib_generated_cuda_dlib.cu.o nvcc fatal : redefinition of argument 'std' CMake Error at dlib_generated_cuda_dlib.cu.o.Release.cmake:222 (message): Error generating /repo/dlib/python_examples/build/dlib_build/CMakeFiles/dlib.dir/dnn/./dlib_generated_cuda_dlib.cu.o

make[2]: *** [dlib_build/CMakeFiles/dlib.dir/dnn/dlib_generated_cuda_dlib.cu.o] Error 1 make[1]: *** [dlib_build/CMakeFiles/dlib.dir/all] Error 2 make: *** [all] Error 2

FYI, I've just installed/built/ran Torch with nn support in last few days so CUDA & CUDNN both work fine.

Thanks for any help!

gojira avatar Jan 04 '17 03:01 gojira

The error you get isn't about cuda, it's this: CMake Error at /private/var/folders/j0/0zny89t96fn1zhn4r3bzjmk00000gn/T/pip-build-BrwHgk/dlib/dlib/cmake_utils/test_for_cudnn/find_cudnn.txt:10 (get_filename_component): get_filename_component unknown component

I'm not sure how that happens unless you have an ancient version of cmake that doesn't support get_filename_component.

davisking avatar Jan 04 '17 11:01 davisking

Do you have multiple versions of cmake installled? One that's really old? I would try building with cmake by itself and see what errors you get.

davisking avatar Jan 04 '17 11:01 davisking

I just pushed a commit that should fix the redefinition of argument 'std' error.

davisking avatar Jan 04 '17 14:01 davisking

I have brew cmake 3.71. I could try build with cmake later.

Build from source now gets much farther - thanks! But I get this.

[100%] Linking CXX shared library dlib.so Undefined symbols for architecture x86_64: "dlib::pixel_traitsdlib::rgb_pixel::num", referenced from: void get_numpy_ndarray_parts<dlib::rgb_pixel, 3>(boost::python::api::object&, dlib::rgb_pixel*&, dlib::array<dlib::rgb_pixel, dlib::memory_manager_stateless_kernel_1 >&, long (&) [3]) in object_detection.cpp.o void get_numpy_ndarray_parts<dlib::rgb_pixel, 3>(boost::python::api::object&, dlib::rgb_pixel*&, dlib::array<dlib::rgb_pixel, dlib::memory_manager_stateless_kernel_1 >&, long (&) [3]) in shape_predictor.cpp.o void get_numpy_ndarray_parts<dlib::rgb_pixel, 3>(boost::python::api::object&, dlib::rgb_pixel*&, dlib::array<dlib::rgb_pixel, dlib::memory_manager_stateless_kernel_1 >&, long (&) [3]) in correlation_tracker.cpp.o void get_numpy_ndarray_parts<dlib::rgb_pixel, 3>(boost::python::api::object&, dlib::rgb_pixel*&, dlib::array<dlib::rgb_pixel, dlib::memory_manager_stateless_kernel_1 >&, long (&) [3]) in gui.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

gojira avatar Jan 04 '17 16:01 gojira

Hmm. Try putting constexpr auto num = dlib::pixel_traits<T>::num;

at line 151 in dlib/python/numpy.h and then replace all the references to pixel_traits::num with the locally declared num.

davisking avatar Jan 04 '17 16:01 davisking

Try the latest code. I think this might be fixed now.

davisking avatar Jan 04 '17 22:01 davisking

That did it. Thanks!

gojira avatar Jan 04 '17 23:01 gojira

No problem :)

davisking avatar Jan 05 '17 01:01 davisking

I have been trying to install dlib on virtual machine(UBUNTU 16.04 LTS) but the machine hangs after running setup.py file (from https://github.com/davisking/dlib). It executes till 79% and then nothing happens and eventually machine stops to work. 18111002_1461751783882047_1618457292_o Please help me to install dlib for python 2.7

dmittal5 avatar Apr 24 '17 08:04 dmittal5

Maybe you are running out of RAM. But in any case, if GCC crashes your computer it isn't because of dlib.

davisking avatar Apr 24 '17 09:04 davisking

Thanks davisking, increasing RAM worked. But I am again stucked! While running a face detection python file, Traceback (most recent call last): File "detect.py", line 9, in face_detector = dlib.get_frontal_face_detector() AttributeError: 'module' object has no attribute 'get_frontal_face_detector'

I just installed dlib and then tried running the file in virtual environment. Please help me!

dmittal5 avatar May 15 '17 12:05 dmittal5