Issue with dlib

I installing face_recognition, but I have issue with the installing dlib.
I tried to only install dlib, It still have issue. This is my log:
Collecting dlib
Using cached dlib-19.21.0.tar.gz (3.2 MB)
Building wheels for collected packages: dlib
Building wheel for dlib (setup.py) … error
ERROR: Command errored out with exit status 1:
command: /home/tpa/ProjectFace/envWork/bin/python3.6 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-a580efx9/dlib/setup.py’"’"’; file=’"’"’/tmp/pip-install-a580efx9/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 /tmp/pip-wheel-ms2t_m3p
cwd: /tmp/pip-install-a580efx9/dlib/
Complete output (223 lines):
running bdist_wheel
running build
running build_py
package init file ‘tools/python/dlib/init.py’ not found (or not a regular file)
running build_ext
Building extension for Python 3.6.9 (default, Oct 8 2020, 12:12:24)
Invoking CMake setup: ‘cmake /tmp/pip-install-a580efx9/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-a580efx9/dlib/build/lib.linux-aarch64-3.6 -DPYTHON_EXECUTABLE=/home/tpa/ProjectFace/envWork/bin/python3.6 -DCMAKE_BUILD_TYPE=Release’
– The C compiler identification is GNU 7.4.0
– The CXX compiler identification is GNU 7.4.0
– Check for working C compiler: /usr/bin/cc
– Check for working C compiler: /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: /usr/bin/c++
– Check for working CXX compiler: /usr/bin/c++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
– Found PythonInterp: /home/tpa/ProjectFace/envWork/bin/python3.6 (found version “3.6.9”)
– Found PythonLibs: /usr/lib/aarch64-linux-gnu/libpython3.6m.so
– Performing Test HAS_CPP14_FLAG
– Performing Test HAS_CPP14_FLAG - Success
– pybind11 v2.2.2
– Using CMake version: 3.10.2
– Compiling dlib version: 19.21.0
– Looking for pthread.h
– Looking for pthread.h - found
– Looking for pthread_create
– Looking for pthread_create - not found
– Looking for pthread_create in pthreads
– Looking for pthread_create in pthreads - not found
– Looking for pthread_create in pthread
– Looking for pthread_create in pthread - found
– Found Threads: TRUE
– Looking for XOpenDisplay in /usr/lib/aarch64-linux-gnu/libX11.so;/usr/lib/aarch64-linux-gnu/libXext.so
– Looking for XOpenDisplay in /usr/lib/aarch64-linux-gnu/libX11.so;/usr/lib/aarch64-linux-gnu/libXext.so - found
– Looking for gethostbyname
– Looking for gethostbyname - found
– Looking for connect
– Looking for connect - found
– Looking for remove
– Looking for remove - found
– Looking for shmat
– Looking for shmat - found
– Looking for IceConnectionNumber in ICE
– Looking for IceConnectionNumber in ICE - found
– Found X11: /usr/lib/aarch64-linux-gnu/libX11.so
– Found system copy of libpng: /usr/lib/aarch64-linux-gnu/libpng.so;/usr/lib/aarch64-linux-gnu/libz.so
– Found system copy of libjpeg: /usr/lib/aarch64-linux-gnu/libjpeg.so
– Searching for BLAS and LAPACK
– Searching for BLAS and LAPACK
– Found PkgConfig: /usr/bin/pkg-config (found version “0.29.1”)
– Checking for module ‘cblas’
– No package ‘cblas’ found
– Checking for module ‘lapack’
– Found lapack, version 0.2.20+ds
– 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 OpenBLAS library
– Looking for sgetrf_single
– Looking for sgetrf_single - found
– Using OpenBLAS’s built in LAPACK
– Looking for cblas_ddot
– Looking for cblas_ddot - found
– Looking for sgesv
– Looking for sgesv - not found
– Looking for sgesv_
– Looking for sgesv_ - not found
– Found CUDA: /usr/local/cuda (found suitable version “10.0”, minimum required is “7.5”)
– Looking for cuDNN install…
– Found cuDNN: /usr/local/cuda/lib64/libcudnn.so
– Building a CUDA test project to see if your compiler is compatible with CUDA…
– Building a cuDNN test project to check if you have the right version of cuDNN installed…
– Enabling CUDA support for dlib. DLIB WILL USE CUDA
– C++11 activated.
– Configuring done
– Generating done
– Build files have been written to: /tmp/pip-install-a580efx9/dlib/build/temp.linux-aarch64-3.6
Invoking CMake build: ‘cmake --build . --config Release – -j2’
[ 2%] Building NVCC (Device) object dlib_build/CMakeFiles/dlib.dir/cuda/dlib_generated_cuda_dlib.cu.o
[ 2%] Building NVCC (Device) object dlib_build/CMakeFiles/dlib.dir/cuda/dlib_generated_cusolver_dlibapi.cu.o
Scanning dependencies of target dlib
[ 4%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bigint/bigint_kernel_1.cpp.o
[ 4%] Building CXX object dlib_build/CMakeFiles/dlib.dir/base64/base64_kernel_1.cpp.o
[ 5%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bigint/bigint_kernel_2.cpp.o
[ 6%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bit_stream/bit_stream_kernel_1.cpp.o
[ 7%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_decoder/entropy_decoder_kernel_1.cpp.o
[ 8%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_decoder/entropy_decoder_kernel_2.cpp.o
[ 9%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_encoder/entropy_encoder_kernel_1.cpp.o
[ 10%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_encoder/entropy_encoder_kernel_2.cpp.o
[ 11%] Building CXX object dlib_build/CMakeFiles/dlib.dir/md5/md5_kernel_1.cpp.o
[ 12%] Building CXX object dlib_build/CMakeFiles/dlib.dir/tokenizer/tokenizer_kernel_1.cpp.o
[ 13%] Building CXX object dlib_build/CMakeFiles/dlib.dir/unicode/unicode.cpp.o
[ 15%] Building CXX object dlib_build/CMakeFiles/dlib.dir/test_for_odr_violations.cpp.o
[ 16%] Building CXX object dlib_build/CMakeFiles/dlib.dir/sockets/sockets_kernel_1.cpp.o
[ 17%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bsp/bsp.cpp.o
[ 18%] Building CXX object dlib_build/CMakeFiles/dlib.dir/dir_nav/dir_nav_kernel_1.cpp.o
[ 19%] Building CXX object dlib_build/CMakeFiles/dlib.dir/dir_nav/dir_nav_kernel_2.cpp.o
[ 20%] Building CXX object dlib_build/CMakeFiles/dlib.dir/dir_nav/dir_nav_extensions.cpp.o
[ 21%] Building CXX object dlib_build/CMakeFiles/dlib.dir/linker/linker_kernel_1.cpp.o
[ 22%] Building CXX object dlib_build/CMakeFiles/dlib.dir/logger/extra_logger_headers.cpp.o
[ 23%] Building CXX object dlib_build/CMakeFiles/dlib.dir/logger/logger_kernel_1.cpp.o
[ 24%] Building CXX object dlib_build/CMakeFiles/dlib.dir/logger/logger_config_file.cpp.o
[ 25%] Building CXX object dlib_build/CMakeFiles/dlib.dir/misc_api/misc_api_kernel_1.cpp.o
[ 26%] Building CXX object dlib_build/CMakeFiles/dlib.dir/misc_api/misc_api_kernel_2.cpp.o
[ 27%] Building CXX object dlib_build/CMakeFiles/dlib.dir/sockets/sockets_extensions.cpp.o
[ 29%] Building CXX object dlib_build/CMakeFiles/dlib.dir/sockets/sockets_kernel_2.cpp.o
[ 30%] Building CXX object dlib_build/CMakeFiles/dlib.dir/sockstreambuf/sockstreambuf.cpp.o
[ 31%] Building CXX object dlib_build/CMakeFiles/dlib.dir/sockstreambuf/sockstreambuf_unbuffered.cpp.o
[ 32%] Building CXX object dlib_build/CMakeFiles/dlib.dir/server/server_kernel.cpp.o
[ 33%] Building CXX object dlib_build/CMakeFiles/dlib.dir/server/server_iostream.cpp.o
[ 34%] Building CXX object dlib_build/CMakeFiles/dlib.dir/server/server_http.cpp.o
[ 35%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/multithreaded_object_extension.cpp.o
[ 36%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/threaded_object_extension.cpp.o
[ 37%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/threads_kernel_1.cpp.o
[ 38%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/threads_kernel_2.cpp.o
[ 39%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/threads_kernel_shared.cpp.o
[ 40%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/thread_pool_extension.cpp.o
[ 41%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/async.cpp.o
[ 43%] Building CXX object dlib_build/CMakeFiles/dlib.dir/timer/timer.cpp.o
[ 44%] Building CXX object dlib_build/CMakeFiles/dlib.dir/stack_trace.cpp.o
[ 45%] Building CXX object dlib_build/CMakeFiles/dlib.dir/cuda/cpu_dlib.cpp.o
[ 46%] Building CXX object dlib_build/CMakeFiles/dlib.dir/cuda/tensor_tools.cpp.o
[ 47%] Building CXX object dlib_build/CMakeFiles/dlib.dir/data_io/image_dataset_metadata.cpp.o
[ 48%] Building CXX object dlib_build/CMakeFiles/dlib.dir/data_io/mnist.cpp.o
[ 49%] Building CXX object dlib_build/CMakeFiles/dlib.dir/global_optimization/global_function_search.cpp.o
[ 50%] Building CXX object dlib_build/CMakeFiles/dlib.dir/filtering/kalman_filter.cpp.o
[ 51%] Building CXX object dlib_build/CMakeFiles/dlib.dir/svm/auto.cpp.o
[ 52%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/fonts.cpp.o
[ 53%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/widgets.cpp.o
[ 54%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/drawable.cpp.o
[ 55%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/canvas_drawing.cpp.o
[ 56%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/style.cpp.o
[ 58%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/base_widgets.cpp.o
[ 59%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_core/gui_core_kernel_1.cpp.o
[ 60%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_core/gui_core_kernel_2.cpp.o
[ 61%] Building CXX object dlib_build/CMakeFiles/dlib.dir/image_loader/png_loader.cpp.o
[ 62%] Building CXX object dlib_build/CMakeFiles/dlib.dir/image_saver/save_png.cpp.o
[ 63%] Building CXX object dlib_build/CMakeFiles/dlib.dir/image_loader/jpeg_loader.cpp.o
[ 64%] Building CXX object dlib_build/CMakeFiles/dlib.dir/image_saver/save_jpeg.cpp.o
[ 65%] Building CXX object dlib_build/CMakeFiles/dlib.dir/cuda/cudnn_dlibapi.cpp.o
[ 66%] Building CXX object dlib_build/CMakeFiles/dlib.dir/cuda/cublas_dlibapi.cpp.o
[ 67%] Building CXX object dlib_build/CMakeFiles/dlib.dir/cuda/curand_dlibapi.cpp.o
[ 68%] Building CXX object dlib_build/CMakeFiles/dlib.dir/cuda/cuda_data_ptr.cpp.o
[ 69%] Building CXX object dlib_build/CMakeFiles/dlib.dir/cuda/gpu_data.cpp.o
[ 70%] Linking CXX static library libdlib.a
[ 70%] Built target dlib
Scanning dependencies of target _dlib_pybind11
[ 72%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/dlib.cpp.o
[ 73%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/matrix.cpp.o
[ 74%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/vector.cpp.o
[ 75%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/svm_c_trainer.cpp.o
[ 76%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/svm_rank_trainer.cpp.o
[ 77%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/decision_functions.cpp.o
[ 78%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/other.cpp.o
[ 79%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/basic.cpp.o
[ 80%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/cca.cpp.o
[ 81%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/sequence_segmenter.cpp.o
[ 82%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/svm_struct.cpp.o
[ 83%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/image.cpp.o
[ 84%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/image2.cpp.o
[ 86%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/image3.cpp.o
[ 87%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/image4.cpp.o
[ 88%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/rectangles.cpp.o
[ 89%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/object_detection.cpp.o
[ 90%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/shape_predictor.cpp.o
[ 91%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/correlation_tracker.cpp.o
[ 92%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/face_recognition.cpp.o
[ 93%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/cnn_face_detector.cpp.o
[ 94%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/global_optimization.cpp.o
[ 95%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/image_dataset_metadata.cpp.o
[ 96%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/numpy_returns.cpp.o
[ 97%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/line.cpp.o
[ 98%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/gui.cpp.o
[100%] Linking CXX shared module /tmp/pip-install-a580efx9/dlib/build/lib.linux-aarch64-3.6/_dlib_pybind11.cpython-36m-aarch64-linux-gnu.so
/usr/local/cuda/lib64/libcudnn.so: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
CMakeFiles/_dlib_pybind11.dir/build.make:763: recipe for target ‘/tmp/pip-install-a580efx9/dlib/build/lib.linux-aarch64-3.6/_dlib_pybind11.cpython-36m-aarch64-linux-gnu.so’ failed
make[2]: *** [/tmp/pip-install-a580efx9/dlib/build/lib.linux-aarch64-3.6/_dlib_pybind11.cpython-36m-aarch64-linux-gnu.so] Error 1
CMakeFiles/Makefile2:67: recipe for target ‘CMakeFiles/_dlib_pybind11.dir/all’ failed
make[1]: *** [CMakeFiles/_dlib_pybind11.dir/all] Error 2
Makefile:83: recipe for target ‘all’ failed
make: *** [all] Error 2
Traceback (most recent call last):
File “”, line 1, in
File “/tmp/pip-install-a580efx9/dlib/setup.py”, line 262, in
‘Topic :: Software Development’,
File “/home/tpa/ProjectFace/envWork/lib/python3.6/site-packages/setuptools/init.py”, line 153, in setup
return distutils.core.setup(**attrs)
File “/usr/lib/python3.6/distutils/core.py”, line 148, in setup
dist.run_commands()
File “/usr/lib/python3.6/distutils/dist.py”, line 955, in run_commands
self.run_command(cmd)
File “/usr/lib/python3.6/distutils/dist.py”, line 974, in run_command
cmd_obj.run()
File “/home/tpa/ProjectFace/envWork/lib/python3.6/site-packages/wheel/bdist_wheel.py”, line 290, in run
self.run_command(‘build’)
File “/usr/lib/python3.6/distutils/cmd.py”, line 313, in run_command
self.distribution.run_command(command)
File “/usr/lib/python3.6/distutils/dist.py”, line 974, in run_command
cmd_obj.run()
File “/usr/lib/python3.6/distutils/command/build.py”, line 135, in run
self.run_command(cmd_name)
File “/usr/lib/python3.6/distutils/cmd.py”, line 313, in run_command
self.distribution.run_command(command)
File “/usr/lib/python3.6/distutils/dist.py”, line 974, in run_command
cmd_obj.run()
File “/tmp/pip-install-a580efx9/dlib/setup.py”, line 135, in run
self.build_extension(ext)
File “/tmp/pip-install-a580efx9/dlib/setup.py”, line 175, in build_extension
subprocess.check_call(cmake_build, cwd=build_folder)
File “/usr/lib/python3.6/subprocess.py”, line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘cmake’, ‘–build’, ‘.’, ‘–config’, ‘Release’, ‘–’, ‘-j2’]’ returned non-zero exit status 2.

ERROR: Failed building wheel for dlib

Could anyone please suggest, how this problem can be resolved?

Thanks in advance

Hi,

Dlib by default not use the GPU architecture for Jetson.
Please build it from source and update the architecture to sm_53 in CMakeLists.txt for Jetson Nano.

Thanks.

I rebuilded from source but I don’t know how update the architecture to sm_53 in CMakeLists.txt. Have you to clone that CMakeLists.txt?

Hi,

The file is located at the {dlib_root}/dlib.
You can modify it with attached 0001-arch-for-Nano.patch.txt (1.1 KB) .

$ git clone -b v19.21 https://github.com/davisking/dlib.git
$ cd dlib/
$ git am 0001-arch-for-Nano.patch
$ make

Thanks.

1 Like