dlib icon indicating copy to clipboard operation
dlib copied to clipboard

Successfully installed dlib still dlib.DLIB_USE_CUDA returning false

Open shiva2410 opened this issue 7 years ago • 20 comments

I am trying to use GPU for @ageitgey face recognition api I installed and compiled dlib successfully during installation of dlib I got Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1 (found suitable version "10.1", minimum required is "7.5") -- Looking for cuDNN install... -- Found cuDNN: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/lib/x64/cudnn.lib -- Building a CUDA test project to see if your compiler is compatible with CUDA... -- Checking 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

BUT now when I am running import dlib print(dlib.DLIB_USE_CUDA) in SPYDER I am getting FALSE please help

##Expected Behavior I expected (dlib.DLIB_USE_CUDA) to return TRUE I expected CNN face detector model to run on GPU

Current Behavior

dlib.DLIB_USE_CUDA is returning false CNN based face detector is taking whole CPU and RAM I also checked gpu usage by using nvidia-smi but it was not showing any usage cuda.get_num_devices() returns 1

Steps to Reproduce

install dlib https://github.com/davisking/dlib install cuda toolkit and other dependecies Run this https://github.com/davisking/dlib

dlib version dlib==19.18.99 dlib: https://github.com/davisking/dlib I am working on Windows 10 64 bit I am using SPYDER

shiva2410 avatar Oct 06 '19 20:10 shiva2410

so hard to install dlib....

17isme avatar Oct 13 '19 16:10 17isme

dlib.DLIB_USE_CUDA is a compile time constant. Therefore, if you install dlib and it says Enabling CUDA support for dlib. DLIB WILL USE CUDA during install, but dlib.DLIB_USE_CUDA is False then this absolutely, 100% guaranteed, means you have installed two separate copies of dlib. One built to use cuda and another not.

This isn't because dlib is hard to install. There is nothing I could possibly do to stop you from installing multiple copies of dlib and configuring them differently.

davisking avatar Oct 13 '19 21:10 davisking

Maybe I need to emphasize that what is happening here is you have two copies of dlib installed in different python environments and you are getting confused about what python environment you are running your stuff in.

davisking avatar Oct 13 '19 21:10 davisking

I got your point @davisking Thnx for helping I wanted to ask that can we run dlibs hog face detectort on multiple cpu cores? If yes can you please tell me how

shiva2410 avatar Oct 14 '19 16:10 shiva2410

Warning: this issue has been inactive for 35 days and will be automatically closed on 2019-11-28 if there is no further activity.

If you are waiting for a response but haven't received one it's possible your question is somehow inappropriate. E.g. it is off topic, you didn't follow the issue submission instructions, or your question is easily answerable by reading the FAQ, dlib's official compilation instructions, dlib's API documentation, or a Google search.

dlib-issue-bot avatar Nov 19 '19 09:11 dlib-issue-bot

Warning: this issue has been inactive for 42 days and will be automatically closed on 2019-11-28 if there is no further activity.

If you are waiting for a response but haven't received one it's possible your question is somehow inappropriate. E.g. it is off topic, you didn't follow the issue submission instructions, or your question is easily answerable by reading the FAQ, dlib's official compilation instructions, dlib's API documentation, or a Google search.

dlib-issue-bot avatar Nov 26 '19 09:11 dlib-issue-bot

Notice: this issue has been closed because it has been inactive for 45 days. You may reopen this issue if it has been closed in error.

dlib-issue-bot avatar Nov 29 '19 09:11 dlib-issue-bot

#2209 import dlib.cuda as cuda print(cuda.get_num_devices()); ... 1 print(cuda.get_device()); 0 dlib.DLIB_USE_CUDA False

still no wits shows that dlib.DLIB_USE_CUDA as False

Can any one tell me how to over come this ?

punitha-valli avatar Oct 15 '20 04:10 punitha-valli

I have similar issue

C:\dlib\dlib-19.21\dlib-19.21\python_examples>python Python 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

import dlib print(dlib.cuda.get_num_devices()) 1 print(dlib.DLIB_USE_CUDA) False

My dlib C++ library found cudnn , but the python dlib has a problem to link cudnn

eagle-dot avatar Feb 02 '21 19:02 eagle-dot

That means it didn't build with cuda support.

On Tue, Feb 2, 2021 at 2:46 PM eagle-dot [email protected] wrote:

I have similar issue

C:\dlib\dlib-19.21\dlib-19.21\python_examples>python Python 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

import dlib print(dlib.cuda.get_num_devices()) 1 print(dlib.DLIB_USE_CUDA) False

My dlib C++ library found cudnn , but the python dlib has a problem to link cudnn

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/davisking/dlib/issues/1892#issuecomment-771927747, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPYFR2E4R2HTMWGIWQVOUTS5BJBFANCNFSM4I55RHRQ .

davisking avatar Feb 07 '21 17:02 davisking

DLIB_USE_CUDA

I had the same problem. Later I found out that I had a dlib package in the conda and pip packages. I deleted dlib from the pip packet.

muslimkhudoyberdiev avatar Jun 15 '21 11:06 muslimkhudoyberdiev

#2209 import dlib.cuda as cuda print(cuda.get_num_devices()); ... 1 print(cuda.get_device()); 0 dlib.DLIB_USE_CUDA False

still no wits shows that dlib.DLIB_USE_CUDA as False

Can any one tell me how to over come this ?

maybe you can try to install it using conda: https://gist.github.com/nguyenhoan1988/ed92d58054b985a1b45a521fcf8fa781

nguyenhoan1988 avatar Oct 19 '21 22:10 nguyenhoan1988

I got your point @davisking Thnx for helping I wanted to ask that can we run dlibs hog face detectort on multiple cpu cores? If yes can you please tell me how

okay so what can we do about it ? should i uninstall the pip dlib package and rebuild it with cuda ? or something else.

kushpandey3009 avatar Jan 25 '24 12:01 kushpandey3009

About the HOG stuff not running on the GPU? That code just doesn't run on the GPU. It's not written in CUDA. So it just is what it is.

On Thu, Jan 25, 2024 at 7:56 AM Kush Pandey @.***> wrote:

I got your point @davisking https://github.com/davisking Thnx for helping I wanted to ask that can we run dlibs hog face detectort on multiple cpu cores? If yes can you please tell me how

okay so what can we do about it ? should i uninstall the pip dlib package and rebuild it with cuda ? or something else.

— Reply to this email directly, view it on GitHub https://github.com/davisking/dlib/issues/1892#issuecomment-1910159365, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPYFR3RG7VBDKQLWSMCDT3YQJJA5AVCNFSM4I55RHR2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJRGAYTKOJTGY2Q . You are receiving this because you were mentioned.Message ID: @.***>

davisking avatar Jan 26 '24 12:01 davisking

DLIB_USE_CUDA

I had the same problem. Later I found out that I had a dlib package in the conda and pip packages. I deleted dlib from the pip packet.

if i delete the pip package dlib then python is unable to find dlib

kushpandey3009 avatar Jan 26 '24 13:01 kushpandey3009

#2209 import dlib.cuda as cuda print(cuda.get_num_devices()); ... 1 print(cuda.get_device()); 0 dlib.DLIB_USE_CUDA False

still no wits shows that dlib.DLIB_USE_CUDA as False

Can any one tell me how to over come this ?

same problem

kushpandey3009 avatar Jan 26 '24 13:01 kushpandey3009

Yeah if you delete dlib it will be deleted :)

The pip package isn't really any different from installing directly from the main github repo. If dlib.DLIB_USE_CUDA is false then it means your system is missing the nvidia libraries needed to use cuda. Anyway, if you do pip install -v dlib pip will not hide all the messages the install process is printing. You should see some messages saying something about why your cuda or nvidia libraries are wrong or missing.

davisking avatar Jan 26 '24 13:01 davisking

can anyone help here, I am getting same error in the dlib usage for cuda device.

import dlib print(dlib.DLIB_USE_CUDA) False

can anyone help here, I am getting same error in the dlib usage for cuda device.

import dlib print(dlib.DLIB_USE_CUDA) False

A little more information would be good in order to resolve the issue like System configuration etc. most likely u must be using pip dlib package but need to build it from scratch also beware of the cuda and cudnn version + path in your environment variables

kushpandey3009 avatar Jul 19 '24 06:07 kushpandey3009

Thanks for your reply @kushpandey3009 , Yes I followed from scratch, I found the solution provided here and its working fine: https://stackoverflow.com/questions/58261342/successfully-installed-dlib-still-dlib-dlib-use-cuda-returning-false