-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Comments
If you are installing the python API, you don't need to run cmake. When you run |
Hello Davis, python |
Use pip's |
This is what happens when i try pip install without CUDA.. Created temporary directory: /tmp/pip-record-eww059xd The similar thing happens when i try to install it with setup.py: Is it my dependencies? |
sudo apt-get install python3-dev |
working for me on google colab - Jan 8, 2024
|
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
The text was updated successfully, but these errors were encountered: