Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to force install Dlib with only CPU support on a GPU machine with Cuda enabled #1885

Closed
rsadiq opened this issue Sep 25, 2019 · 6 comments

Comments

@rsadiq
Copy link

rsadiq commented Sep 25, 2019

Hello,
I am trying to install Dlib CPU version on a GPU machine with Cuda and everything installed and working. But even when I try to install from source and using the flag to not use CUDA, but it still is using Cuda.

On internet and issues, all I can see is problem with using Cuda. I can use Cuda and I don't want that.

Expected Behavior

It should not use Cuda and only go for cpu

Current Behavior

But Dlib after installation tries to use GPU.

Steps to Reproduce

I am using Google Colab which by default provide us Dlib, so I am uninstalling it.
!pip uninstall dlib
!pip uninstall face_recognition

if you are in directory where you previously cloned Dlib, remove it

!rm -r dlib/
!git clone https://github.com/davisking/dlib.git
%cd dlib
!mkdir build
%cd build
!cmake .. -DDLIB_USE_CUDA=0 -DUSE_AVX_INSTRUCTIONS=1
!cmake --build .
%cd ..
!python setup.py install --no DLIB_USE_CUDA

The builds and install successfully and I can import Dlib
!pip install face_recognition
import dlib
import face_recognition

RuntimeError Traceback (most recent call last)
in ()
2 get_ipython().system('pip install face_recognition')
3 import dlib
----> 4 import face_recognition

1 frames
/usr/local/lib/python3.6/dist-packages/face_recognition/api.py in ()
21
22 cnn_face_detection_model = face_recognition_models.cnn_face_detector_model_location()
---> 23 cnn_face_detector = dlib.cnn_face_detection_model_v1(cnn_face_detection_model)
24
25 face_recognition_model = face_recognition_models.face_recognition_model_location()

RuntimeError: Error while calling cudaGetDevice(&the_device_id) in file /tmp/pip-install-9p_kkgzg/dlib/dlib/cuda/gpu_data.cpp:178. code: 38, reason: no CUDA-capable device is detected

PS: When I change my runtime to GPU it works fine, since it finds GPU. But when I set the runtime as TPU or CPU it can not find GPU obviously since it was built for GPU.
So how can we force Dlib to use only CPU even on GPU machine

@rsadiq rsadiq changed the title How to force install Dlib on a GPU machine with Cuda enabled How to force install Dlib with only CPU support on a GPU machine with Cuda enabled Sep 25, 2019
@davisking
Copy link
Owner

If you are installing the python API, you don't need to run cmake.

When you run python setup.py install --no DLIB_USE_CUDA it will print a bunch of stuff, some of it will talk about cuda and say if it's turning cuda on or off. It should say it's turning it off. The issue is almost certainly that you have multiple copies of dlib installed still and are using the one that was built with cuda enabled, rather than the one you just built.

@rsadiq
Copy link
Author

rsadiq commented Sep 27, 2019

Hello Davis,
Thank you for your response.
I made sure that i have removed every copy of dlib before fresh start.
and confirmed it by
import dlib

python setup.py install --no DLIB_USE_CUDA does not show if the CUDA is off or on, But if we dont use it, it does show that its looking for CUDA, So i assume that its not using it. And after trying out all the things, the thing that worked for me is: "REBOOT THE SYSTEM".
Sorry for opening the issue before doing it. Closing it as it is not an issue. We can use Dlib with CPU on GPU machine and we have to build from source.
**A suggestion: May be via PIP install, we can have an option to install CPU or GPU version as per choice ? like tensorflow and tensorflow-gpu ?

@rsadiq rsadiq closed this as completed Sep 27, 2019
@davisking
Copy link
Owner

Use pip's --install-option. Like sudo pip install -v --install-option="--no" --install-option="DLIB_USE_CUDA" dlib. See https://pip.pypa.io/en/stable/reference/pip_install/

@harshilishere
Copy link

This is what happens when i try pip install without CUDA..

Created temporary directory: /tmp/pip-record-eww059xd
Running command /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-nwkrzn1s/dlib/setup.py'"'"'; file='"'"'/tmp/pip-install-nwkrzn1s/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 /tmp/pip-record-eww059xd/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7/dlib --no DLIB_USE_CUDA
running install
running build
running build_py
package init file 'dlib/init.py' not found (or not a regular file)
running build_ext
Building extension for Python 3.7.5 (default, Nov 7 2019, 10:50:52)
Invoking CMake setup: 'cmake /tmp/pip-install-nwkrzn1s/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-nwkrzn1s/dlib/build/lib.linux-x86_64-3.7 -DPYTHON_EXECUTABLE=/usr/bin/python3 -DDLIB_USE_CUDA=no -DCMAKE_BUILD_TYPE=Release'
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.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: /usr/bin/python3 (found version "3.7.5")
-- Found PythonLibs: python3.7m
-- 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.20.0
-- SSE4 instructions can be executed by the host processor.
-- AVX instructions can be executed by the host processor.
-- Enabling AVX instructions
-- 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/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-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/x86_64-linux-gnu/libX11.so
-- Found system copy of libpng: /usr/lib/x86_64-linux-gnu/libpng.so;/usr/lib/x86_64-linux-gnu/libz.so
-- Found system copy of libjpeg: /usr/lib/x86_64-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 3.10.3
-- 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 ATLAS BLAS library
-- Looking for cblas_ddot
-- Looking for cblas_ddot - found
-- Looking for sgesv
-- Looking for sgesv - not found
-- Looking for sgesv_
-- Looking for sgesv_ - found
-- C++11 activated.
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/pip-install-nwkrzn1s/dlib/build/temp.linux-x86_64-3.7
Invoking CMake build: 'cmake --build . --config Release -- -j6'
Scanning dependencies of target dlib
[ 3%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bigint/bigint_kernel_1.cpp.o
[ 3%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bit_stream/bit_stream_kernel_1.cpp.o
[ 3%] Building CXX object dlib_build/CMakeFiles/dlib.dir/base64/base64_kernel_1.cpp.o
[ 4%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bigint/bigint_kernel_2.cpp.o
[ 5%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_decoder/entropy_decoder_kernel_1.cpp.o
[ 6%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_decoder/entropy_decoder_kernel_2.cpp.o
[ 8%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_encoder/entropy_encoder_kernel_1.cpp.o
[ 9%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_encoder/entropy_encoder_kernel_2.cpp.o
[ 10%] Building CXX object dlib_build/CMakeFiles/dlib.dir/md5/md5_kernel_1.cpp.o
[ 11%] Building CXX object dlib_build/CMakeFiles/dlib.dir/tokenizer/tokenizer_kernel_1.cpp.o
[ 12%] Building CXX object dlib_build/CMakeFiles/dlib.dir/unicode/unicode.cpp.o
[ 13%] Building CXX object dlib_build/CMakeFiles/dlib.dir/test_for_odr_violations.cpp.o
[ 15%] Building CXX object dlib_build/CMakeFiles/dlib.dir/sockets/sockets_kernel_1.cpp.o
[ 16%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bsp/bsp.cpp.o
[ 17%] Building CXX object dlib_build/CMakeFiles/dlib.dir/dir_nav/dir_nav_kernel_1.cpp.o
[ 18%] Building CXX object dlib_build/CMakeFiles/dlib.dir/dir_nav/dir_nav_kernel_2.cpp.o
[ 19%] Building CXX object dlib_build/CMakeFiles/dlib.dir/dir_nav/dir_nav_extensions.cpp.o
[ 20%] 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
[ 36%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/multithreaded_object_extension.cpp.o
[ 37%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/threaded_object_extension.cpp.o
[ 38%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/threads_kernel_1.cpp.o
[ 39%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/threads_kernel_2.cpp.o
[ 40%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/threads_kernel_shared.cpp.o
[ 41%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/thread_pool_extension.cpp.o
[ 43%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/async.cpp.o
[ 44%] Building CXX object dlib_build/CMakeFiles/dlib.dir/timer/timer.cpp.o
[ 45%] Building CXX object dlib_build/CMakeFiles/dlib.dir/stack_trace.cpp.o
[ 46%] Building CXX object dlib_build/CMakeFiles/dlib.dir/cuda/cpu_dlib.cpp.o
[ 47%] Building CXX object dlib_build/CMakeFiles/dlib.dir/cuda/tensor_tools.cpp.o
[ 48%] Building CXX object dlib_build/CMakeFiles/dlib.dir/data_io/image_dataset_metadata.cpp.o
[ 50%] Building CXX object dlib_build/CMakeFiles/dlib.dir/data_io/mnist.cpp.o
[ 51%] Building CXX object dlib_build/CMakeFiles/dlib.dir/global_optimization/global_function_search.cpp.o
[ 52%] Building CXX object dlib_build/CMakeFiles/dlib.dir/filtering/kalman_filter.cpp.o
[ 53%] Building CXX object dlib_build/CMakeFiles/dlib.dir/svm/auto.cpp.o
[ 54%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/fonts.cpp.o
[ 55%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/widgets.cpp.o
[ 56%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/drawable.cpp.o
[ 58%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/canvas_drawing.cpp.o
[ 59%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/style.cpp.o
[ 60%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/base_widgets.cpp.o
[ 61%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_core/gui_core_kernel_1.cpp.o
[ 62%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_core/gui_core_kernel_2.cpp.o
[ 63%] Building CXX object dlib_build/CMakeFiles/dlib.dir/image_loader/png_loader.cpp.o
[ 65%] Building CXX object dlib_build/CMakeFiles/dlib.dir/image_saver/save_png.cpp.o
[ 66%] Building CXX object dlib_build/CMakeFiles/dlib.dir/image_loader/jpeg_loader.cpp.o
[ 67%] Building CXX object dlib_build/CMakeFiles/dlib.dir/image_saver/save_jpeg.cpp.o
[ 68%] Linking CXX static library libdlib.a
[ 68%] Built target dlib
Scanning dependencies of target dlib_python
[ 70%] Building CXX object CMakeFiles/dlib_python.dir/src/dlib.cpp.o
[ 70%] Building CXX object CMakeFiles/dlib_python.dir/src/matrix.cpp.o
[ 72%] Building CXX object CMakeFiles/dlib_python.dir/src/vector.cpp.o
[ 74%] Building CXX object CMakeFiles/dlib_python.dir/src/decision_functions.cpp.o
[ 74%] Building CXX object CMakeFiles/dlib_python.dir/src/svm_c_trainer.cpp.o
[ 75%] Building CXX object CMakeFiles/dlib_python.dir/src/svm_rank_trainer.cpp.o
In file included from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/pytypes.h:12:0,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/cast.h:13,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/attr.h:13,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/pybind11.h:43,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/../dlib/python/pybind_utils.h:6,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/../dlib/python.h:6,
from /tmp/pip-install-nwkrzn1s/dlib/tools/python/src/opaque_types.h:6,
from /tmp/pip-install-nwkrzn1s/dlib/tools/python/src/vector.cpp:4:
/tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/detail/common.h:111:10: fatal error: Python.h: No such file or directory
#include <Python.h>
^~~~~~~~~~
compilation terminated.
CMakeFiles/dlib_python.dir/build.make:110: recipe for target 'CMakeFiles/dlib_python.dir/src/vector.cpp.o' failed
make[2]: *** [CMakeFiles/dlib_python.dir/src/vector.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/pytypes.h:12:0,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/cast.h:13,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/attr.h:13,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/pybind11.h:43,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/../dlib/python/pybind_utils.h:6,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/../dlib/python.h:6,
from /tmp/pip-install-nwkrzn1s/dlib/tools/python/src/opaque_types.h:6,
from /tmp/pip-install-nwkrzn1s/dlib/tools/python/src/dlib.cpp:4:
/tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/detail/common.h:111:10: fatal error: Python.h: No such file or directory
#include <Python.h>
^~~~~~~~~~
In file included from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/pytypes.h:12:0,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/cast.h:13,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/attr.h:13,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/pybind11.h:43,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/../dlib/python/pybind_utils.h:6,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/../dlib/python.h:6,
from /tmp/pip-install-nwkrzn1s/dlib/tools/python/src/opaque_types.h:6,
from /tmp/pip-install-nwkrzn1s/dlib/tools/python/src/decision_functions.cpp:4:
/tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/detail/common.h:111:10: fatal error: Python.h: No such file or directory
#include <Python.h>
^~~~~~~~~~
compilation terminated.
compilation terminated.
In file included from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/pytypes.h:12:0,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/cast.h:13,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/attr.h:13,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/pybind11.h:43,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/../dlib/python/pybind_utils.h:6,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/../dlib/python.h:6,
from /tmp/pip-install-nwkrzn1s/dlib/tools/python/src/opaque_types.h:6,
from /tmp/pip-install-nwkrzn1s/dlib/tools/python/src/matrix.cpp:4:
/tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/detail/common.h:111:10: fatal error: Python.h: No such file or directory
#include <Python.h>
^~~~~~~~~~
compilation terminated.
CMakeFiles/dlib_python.dir/build.make:62: recipe for target 'CMakeFiles/dlib_python.dir/src/dlib.cpp.o' failed
make[2]: *** [CMakeFiles/dlib_python.dir/src/dlib.cpp.o] Error 1
CMakeFiles/dlib_python.dir/build.make:182: recipe for target 'CMakeFiles/dlib_python.dir/src/decision_functions.cpp.o' failed
make[2]: *** [CMakeFiles/dlib_python.dir/src/decision_functions.cpp.o] Error 1
In file included from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/pytypes.h:12:0,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/cast.h:13,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/attr.h:13,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/pybind11.h:43,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/../dlib/python/pybind_utils.h:6,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/../dlib/python.h:6,
from /tmp/pip-install-nwkrzn1s/dlib/tools/python/src/opaque_types.h:6,
from /tmp/pip-install-nwkrzn1s/dlib/tools/python/src/svm_c_trainer.cpp:4:
/tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/detail/common.h:111:10: fatal error: Python.h: No such file or directory
#include <Python.h>
^~~~~~~~~~
compilation terminated.
CMakeFiles/dlib_python.dir/build.make:86: recipe for target 'CMakeFiles/dlib_python.dir/src/matrix.cpp.o' failed
make[2]: *** [CMakeFiles/dlib_python.dir/src/matrix.cpp.o] Error 1
In file included from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/pytypes.h:12:0,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/cast.h:13,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/attr.h:13,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/pybind11.h:43,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/../dlib/python/pybind_utils.h:6,
from /tmp/pip-install-nwkrzn1s/dlib/dlib/../dlib/python.h:6,
from /tmp/pip-install-nwkrzn1s/dlib/tools/python/src/opaque_types.h:6,
from /tmp/pip-install-nwkrzn1s/dlib/tools/python/src/svm_rank_trainer.cpp:4:
/tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/detail/common.h:111:10: fatal error: Python.h: No such file or directory
#include <Python.h>
^~~~~~~~~~
compilation terminated.
CMakeFiles/dlib_python.dir/build.make:134: recipe for target 'CMakeFiles/dlib_python.dir/src/svm_c_trainer.cpp.o' failed
make[2]: *** [CMakeFiles/dlib_python.dir/src/svm_c_trainer.cpp.o] Error 1
CMakeFiles/dlib_python.dir/build.make:158: recipe for target 'CMakeFiles/dlib_python.dir/src/svm_rank_trainer.cpp.o' failed
make[2]: *** [CMakeFiles/dlib_python.dir/src/svm_rank_trainer.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/dlib_python.dir/all' failed
make[1]: *** [CMakeFiles/dlib_python.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-nwkrzn1s/dlib/setup.py", line 261, in
'Topic :: Software Development',
File "/usr/lib/python3/dist-packages/setuptools/init.py", line 129, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.7/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/usr/lib/python3.7/distutils/command/install.py", line 589, in run
self.run_command('build')
File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3.7/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/tmp/pip-install-nwkrzn1s/dlib/setup.py", line 135, in run
self.build_extension(ext)
File "/tmp/pip-install-nwkrzn1s/dlib/setup.py", line 175, in build_extension
subprocess.check_call(cmake_build, cwd=build_folder)
File "/usr/lib/python3.7/subprocess.py", line 363, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j6']' returned non-zero exit status 2.
Running setup.py install for dlib ... error
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-nwkrzn1s/dlib/setup.py'"'"'; file='"'"'/tmp/pip-install-nwkrzn1s/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 /tmp/pip-record-eww059xd/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7/dlib --no DLIB_USE_CUDA Check the logs for full command output.

The similar thing happens when i try to install it with setup.py:
#109

Is it my dependencies?

@projectz-ali
Copy link

This is what happens when i try pip install without CUDA..

Created temporary directory: /tmp/pip-record-eww059xd Running command /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-nwkrzn1s/dlib/setup.py'"'"'; file='"'"'/tmp/pip-install-nwkrzn1s/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 /tmp/pip-record-eww059xd/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7/dlib --no DLIB_USE_CUDA running install running build running build_py package init file 'dlib/init.py' not found (or not a regular file) running build_ext Building extension for Python 3.7.5 (default, Nov 7 2019, 10:50:52) Invoking CMake setup: 'cmake /tmp/pip-install-nwkrzn1s/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-nwkrzn1s/dlib/build/lib.linux-x86_64-3.7 -DPYTHON_EXECUTABLE=/usr/bin/python3 -DDLIB_USE_CUDA=no -DCMAKE_BUILD_TYPE=Release' -- The C compiler identification is GNU 7.5.0 -- The CXX compiler identification is GNU 7.5.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: /usr/bin/python3 (found version "3.7.5") -- Found PythonLibs: python3.7m -- 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.20.0 -- SSE4 instructions can be executed by the host processor. -- AVX instructions can be executed by the host processor. -- Enabling AVX instructions -- 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/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so -- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-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/x86_64-linux-gnu/libX11.so -- Found system copy of libpng: /usr/lib/x86_64-linux-gnu/libpng.so;/usr/lib/x86_64-linux-gnu/libz.so -- Found system copy of libjpeg: /usr/lib/x86_64-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 3.10.3 -- 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 ATLAS BLAS library -- Looking for cblas_ddot -- Looking for cblas_ddot - found -- Looking for sgesv -- Looking for sgesv - not found -- Looking for sgesv_ -- Looking for sgesv_ - found -- C++11 activated. -- Configuring done -- Generating done -- Build files have been written to: /tmp/pip-install-nwkrzn1s/dlib/build/temp.linux-x86_64-3.7 Invoking CMake build: 'cmake --build . --config Release -- -j6' Scanning dependencies of target dlib [ 3%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bigint/bigint_kernel_1.cpp.o [ 3%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bit_stream/bit_stream_kernel_1.cpp.o [ 3%] Building CXX object dlib_build/CMakeFiles/dlib.dir/base64/base64_kernel_1.cpp.o [ 4%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bigint/bigint_kernel_2.cpp.o [ 5%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_decoder/entropy_decoder_kernel_1.cpp.o [ 6%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_decoder/entropy_decoder_kernel_2.cpp.o [ 8%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_encoder/entropy_encoder_kernel_1.cpp.o [ 9%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_encoder/entropy_encoder_kernel_2.cpp.o [ 10%] Building CXX object dlib_build/CMakeFiles/dlib.dir/md5/md5_kernel_1.cpp.o [ 11%] Building CXX object dlib_build/CMakeFiles/dlib.dir/tokenizer/tokenizer_kernel_1.cpp.o [ 12%] Building CXX object dlib_build/CMakeFiles/dlib.dir/unicode/unicode.cpp.o [ 13%] Building CXX object dlib_build/CMakeFiles/dlib.dir/test_for_odr_violations.cpp.o [ 15%] Building CXX object dlib_build/CMakeFiles/dlib.dir/sockets/sockets_kernel_1.cpp.o [ 16%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bsp/bsp.cpp.o [ 17%] Building CXX object dlib_build/CMakeFiles/dlib.dir/dir_nav/dir_nav_kernel_1.cpp.o [ 18%] Building CXX object dlib_build/CMakeFiles/dlib.dir/dir_nav/dir_nav_kernel_2.cpp.o [ 19%] Building CXX object dlib_build/CMakeFiles/dlib.dir/dir_nav/dir_nav_extensions.cpp.o [ 20%] 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 [ 36%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/multithreaded_object_extension.cpp.o [ 37%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/threaded_object_extension.cpp.o [ 38%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/threads_kernel_1.cpp.o [ 39%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/threads_kernel_2.cpp.o [ 40%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/threads_kernel_shared.cpp.o [ 41%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/thread_pool_extension.cpp.o [ 43%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/async.cpp.o [ 44%] Building CXX object dlib_build/CMakeFiles/dlib.dir/timer/timer.cpp.o [ 45%] Building CXX object dlib_build/CMakeFiles/dlib.dir/stack_trace.cpp.o [ 46%] Building CXX object dlib_build/CMakeFiles/dlib.dir/cuda/cpu_dlib.cpp.o [ 47%] Building CXX object dlib_build/CMakeFiles/dlib.dir/cuda/tensor_tools.cpp.o [ 48%] Building CXX object dlib_build/CMakeFiles/dlib.dir/data_io/image_dataset_metadata.cpp.o [ 50%] Building CXX object dlib_build/CMakeFiles/dlib.dir/data_io/mnist.cpp.o [ 51%] Building CXX object dlib_build/CMakeFiles/dlib.dir/global_optimization/global_function_search.cpp.o [ 52%] Building CXX object dlib_build/CMakeFiles/dlib.dir/filtering/kalman_filter.cpp.o [ 53%] Building CXX object dlib_build/CMakeFiles/dlib.dir/svm/auto.cpp.o [ 54%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/fonts.cpp.o [ 55%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/widgets.cpp.o [ 56%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/drawable.cpp.o [ 58%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/canvas_drawing.cpp.o [ 59%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/style.cpp.o [ 60%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/base_widgets.cpp.o [ 61%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_core/gui_core_kernel_1.cpp.o [ 62%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_core/gui_core_kernel_2.cpp.o [ 63%] Building CXX object dlib_build/CMakeFiles/dlib.dir/image_loader/png_loader.cpp.o [ 65%] Building CXX object dlib_build/CMakeFiles/dlib.dir/image_saver/save_png.cpp.o [ 66%] Building CXX object dlib_build/CMakeFiles/dlib.dir/image_loader/jpeg_loader.cpp.o [ 67%] Building CXX object dlib_build/CMakeFiles/dlib.dir/image_saver/save_jpeg.cpp.o [ 68%] Linking CXX static library libdlib.a [ 68%] Built target dlib Scanning dependencies of target dlib_python [ 70%] Building CXX object CMakeFiles/dlib_python.dir/src/dlib.cpp.o [ 70%] Building CXX object CMakeFiles/dlib_python.dir/src/matrix.cpp.o [ 72%] Building CXX object CMakeFiles/dlib_python.dir/src/vector.cpp.o [ 74%] Building CXX object CMakeFiles/dlib_python.dir/src/decision_functions.cpp.o [ 74%] Building CXX object CMakeFiles/dlib_python.dir/src/svm_c_trainer.cpp.o [ 75%] Building CXX object CMakeFiles/dlib_python.dir/src/svm_rank_trainer.cpp.o In file included from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/pytypes.h:12:0, from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/cast.h:13, from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/attr.h:13, from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/pybind11.h:43, from /tmp/pip-install-nwkrzn1s/dlib/dlib/../dlib/python/pybind_utils.h:6, from /tmp/pip-install-nwkrzn1s/dlib/dlib/../dlib/python.h:6, from /tmp/pip-install-nwkrzn1s/dlib/tools/python/src/opaque_types.h:6, from /tmp/pip-install-nwkrzn1s/dlib/tools/python/src/vector.cpp:4: /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/detail/common.h:111:10: fatal error: Python.h: No such file or directory #include <Python.h> ^~~~~~~~~~ compilation terminated. CMakeFiles/dlib_python.dir/build.make:110: recipe for target 'CMakeFiles/dlib_python.dir/src/vector.cpp.o' failed make[2]: *** [CMakeFiles/dlib_python.dir/src/vector.cpp.o] Error 1 make[2]: *** Waiting for unfinished jobs.... In file included from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/pytypes.h:12:0, from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/cast.h:13, from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/attr.h:13, from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/pybind11.h:43, from /tmp/pip-install-nwkrzn1s/dlib/dlib/../dlib/python/pybind_utils.h:6, from /tmp/pip-install-nwkrzn1s/dlib/dlib/../dlib/python.h:6, from /tmp/pip-install-nwkrzn1s/dlib/tools/python/src/opaque_types.h:6, from /tmp/pip-install-nwkrzn1s/dlib/tools/python/src/dlib.cpp:4: /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/detail/common.h:111:10: fatal error: Python.h: No such file or directory #include <Python.h> ^~~~~~~~~~ In file included from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/pytypes.h:12:0, from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/cast.h:13, from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/attr.h:13, from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/pybind11.h:43, from /tmp/pip-install-nwkrzn1s/dlib/dlib/../dlib/python/pybind_utils.h:6, from /tmp/pip-install-nwkrzn1s/dlib/dlib/../dlib/python.h:6, from /tmp/pip-install-nwkrzn1s/dlib/tools/python/src/opaque_types.h:6, from /tmp/pip-install-nwkrzn1s/dlib/tools/python/src/decision_functions.cpp:4: /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/detail/common.h:111:10: fatal error: Python.h: No such file or directory #include <Python.h> ^~~~~~~~~~ compilation terminated. compilation terminated. In file included from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/pytypes.h:12:0, from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/cast.h:13, from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/attr.h:13, from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/pybind11.h:43, from /tmp/pip-install-nwkrzn1s/dlib/dlib/../dlib/python/pybind_utils.h:6, from /tmp/pip-install-nwkrzn1s/dlib/dlib/../dlib/python.h:6, from /tmp/pip-install-nwkrzn1s/dlib/tools/python/src/opaque_types.h:6, from /tmp/pip-install-nwkrzn1s/dlib/tools/python/src/matrix.cpp:4: /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/detail/common.h:111:10: fatal error: Python.h: No such file or directory #include <Python.h> ^~~~~~~~~~ compilation terminated. CMakeFiles/dlib_python.dir/build.make:62: recipe for target 'CMakeFiles/dlib_python.dir/src/dlib.cpp.o' failed make[2]: *** [CMakeFiles/dlib_python.dir/src/dlib.cpp.o] Error 1 CMakeFiles/dlib_python.dir/build.make:182: recipe for target 'CMakeFiles/dlib_python.dir/src/decision_functions.cpp.o' failed make[2]: *** [CMakeFiles/dlib_python.dir/src/decision_functions.cpp.o] Error 1 In file included from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/pytypes.h:12:0, from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/cast.h:13, from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/attr.h:13, from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/pybind11.h:43, from /tmp/pip-install-nwkrzn1s/dlib/dlib/../dlib/python/pybind_utils.h:6, from /tmp/pip-install-nwkrzn1s/dlib/dlib/../dlib/python.h:6, from /tmp/pip-install-nwkrzn1s/dlib/tools/python/src/opaque_types.h:6, from /tmp/pip-install-nwkrzn1s/dlib/tools/python/src/svm_c_trainer.cpp:4: /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/detail/common.h:111:10: fatal error: Python.h: No such file or directory #include <Python.h> ^~~~~~~~~~ compilation terminated. CMakeFiles/dlib_python.dir/build.make:86: recipe for target 'CMakeFiles/dlib_python.dir/src/matrix.cpp.o' failed make[2]: *** [CMakeFiles/dlib_python.dir/src/matrix.cpp.o] Error 1 In file included from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/pytypes.h:12:0, from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/cast.h:13, from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/attr.h:13, from /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/pybind11.h:43, from /tmp/pip-install-nwkrzn1s/dlib/dlib/../dlib/python/pybind_utils.h:6, from /tmp/pip-install-nwkrzn1s/dlib/dlib/../dlib/python.h:6, from /tmp/pip-install-nwkrzn1s/dlib/tools/python/src/opaque_types.h:6, from /tmp/pip-install-nwkrzn1s/dlib/tools/python/src/svm_rank_trainer.cpp:4: /tmp/pip-install-nwkrzn1s/dlib/dlib/external/pybind11/include/pybind11/detail/common.h:111:10: fatal error: Python.h: No such file or directory #include <Python.h> ^~~~~~~~~~ compilation terminated. CMakeFiles/dlib_python.dir/build.make:134: recipe for target 'CMakeFiles/dlib_python.dir/src/svm_c_trainer.cpp.o' failed make[2]: *** [CMakeFiles/dlib_python.dir/src/svm_c_trainer.cpp.o] Error 1 CMakeFiles/dlib_python.dir/build.make:158: recipe for target 'CMakeFiles/dlib_python.dir/src/svm_rank_trainer.cpp.o' failed make[2]: *** [CMakeFiles/dlib_python.dir/src/svm_rank_trainer.cpp.o] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/dlib_python.dir/all' failed make[1]: *** [CMakeFiles/dlib_python.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-nwkrzn1s/dlib/setup.py", line 261, in 'Topic :: Software Development', File "/usr/lib/python3/dist-packages/setuptools/init.py", line 129, in setup return distutils.core.setup(**attrs) File "/usr/lib/python3.7/distutils/core.py", line 148, in setup dist.run_commands() File "/usr/lib/python3.7/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 61, in run return orig.install.run(self) File "/usr/lib/python3.7/distutils/command/install.py", line 589, in run self.run_command('build') File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/usr/lib/python3.7/distutils/command/build.py", line 135, in run self.run_command(cmd_name) File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/tmp/pip-install-nwkrzn1s/dlib/setup.py", line 135, in run self.build_extension(ext) File "/tmp/pip-install-nwkrzn1s/dlib/setup.py", line 175, in build_extension subprocess.check_call(cmake_build, cwd=build_folder) File "/usr/lib/python3.7/subprocess.py", line 363, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j6']' returned non-zero exit status 2. Running setup.py install for dlib ... error ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-nwkrzn1s/dlib/setup.py'"'"'; file='"'"'/tmp/pip-install-nwkrzn1s/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 /tmp/pip-record-eww059xd/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7/dlib --no DLIB_USE_CUDA Check the logs for full command output.

The similar thing happens when i try to install it with setup.py: #109

Is it my dependencies?

sudo apt-get install python3-dev
should do the trick for you.

@Arslan-Mehmood1
Copy link

working for me on google colab - Jan 8, 2024

!pip uninstall dlib -y
!pip uninstall face_recognition

!git clone https://github.com/davisking/dlib.git
%cd dlib
!mkdir build
%cd build
!cmake .. -DDLIB_USE_CUDA=0 -DUSE_AVX_INSTRUCTIONS=1
!cmake --build .
%cd ..
!python setup.py install --no DLIB_USE_CUDA

%cd ..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants