Can't install dlib , missing cmake module

python3-devel and tools development already installed with development libraries .

luc@fedora39:~$ sudo dnf install cmake
Last metadata expiration check: 3:27:22 ago on Fri 26 Jul 2024 01:44:49 PM CEST.
Package cmake-3.27.7-1.fc39.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
luc@fedora39:~$ cd ComfyUI
luc@fedora39:~/ComfyUI$ source .venv/bin/activate
(.venv) luc@fedora39:~/ComfyUI$ pip uninstall cmake
Found existing installation: cmake 3.30.1
Uninstalling cmake-3.30.1:
  Would remove:
    /home/luc/ComfyUI/.venv/bin/cmake
    /home/luc/ComfyUI/.venv/bin/cpack
    /home/luc/ComfyUI/.venv/bin/ctest
    /home/luc/ComfyUI/.venv/lib/python3.12/site-packages/cmake-3.30.1.dist-info/*
    /home/luc/ComfyUI/.venv/lib/python3.12/site-packages/cmake/*
Proceed (Y/n)? y
  Successfully uninstalled cmake-3.30.1
(.venv) luc@fedora39:~/ComfyUI$ pip install cmake
Collecting cmake
  Using cached cmake-3.30.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.1 kB)
Using cached cmake-3.30.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (26.9 MB)
Installing collected packages: cmake
Successfully installed cmake-3.30.1
(.venv) luc@fedora39:~/ComfyUI$ pip install dlib
Collecting dlib
  Using cached dlib-19.24.4.tar.gz (3.3 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: dlib
  Building wheel for dlib (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  Ă— Building wheel for dlib (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [13 lines of output]
      <string>:210: SyntaxWarning: invalid escape sequence '\('
      <string>:211: SyntaxWarning: invalid escape sequence '\('
      <string>:212: SyntaxWarning: invalid escape sequence '\('
      running bdist_wheel
      running build
      running build_ext
      Traceback (most recent call last):
        File "/home/luc/ComfyUI/.venv/bin/cmake", line 5, in <module>
          from cmake import cmake
      ModuleNotFoundError: No module named 'cmake'
      
      ERROR: CMake must be installed to build dlib
      
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for dlib
Failed to build dlib
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (dlib)

(.venv) luc@fedora39:~/ComfyUI$ pip show cmake
Name: cmake
Version: 3.30.1
Summary: CMake is an open-source, cross-platform family of tools designed to build, test and package software
Home-page: https://cmake.org
Author: 
Author-email: Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>
License: Apache 2.0
Location: /home/luc/ComfyUI/.venv/lib/python3.12/site-packages
Requires: 
Required-by: 
(.venv) luc@fedora39:~/ComfyUI$ 


You installed the /usr/bin/cmake, but that is not a python module.
Maybe you need this?

python3-cmake-build-extension.noarch : Setuptools extension to build and package CMake projects

hi, maybe and how do you install those Setuptools ?

Its a fedora RPM, I should have made that clear, sorry.

dnf install python3-cmake-build-extension

don’t be sorry , it is just my limited knowledge in fedora linux system, i try that right now

still the same

uc@fedora39:~$ sudo dnf install python3-cmake-build-extension
Last metadata expiration check: 3:59:09 ago on Fri 26 Jul 2024 01:44:49 PM CEST.
Dependencies resolved.
=====================================================================================================================================================================================================
 Package                                                       Architecture                           Version                                          Repository                               Size
=====================================================================================================================================================================================================
Installing:
 python3-cmake-build-extension                                 noarch                                 0.6.0-1.fc39                                     updates                                  32 k
Installing dependencies:
 ninja-build                                                   x86_64                                 1.11.1-8.fc39                                    updates                                 172 k
 python3-GitPython                                             noarch                                 3.1.40-1.fc39                                    updates                                 381 k
 python3-gitdb                                                 noarch                                 4.0.10-3.fc39                                    fedora                                  142 k
 python3-setuptools_scm                                        noarch                                 7.1.0-7.fc39                                     fedora                                  107 k
 python3-smmap                                                 noarch                                 5.0.0-6.fc39                                     fedora                                   62 k
 python3-typing-extensions                                     noarch                                 4.12.2-2.fc39                                    updates                                  89 k

Transaction Summary
=====================================================================================================================================================================================================
Install  7 Packages

Total download size: 986 k
Installed size: 3.6 M
Is this ok [y/N]: y
Downloading Packages:
(1/7): python3-setuptools_scm-7.1.0-7.fc39.noarch.rpm                                                                                                                741 kB/s | 107 kB     00:00    
(2/7): python3-smmap-5.0.0-6.fc39.noarch.rpm                                                                                                                         381 kB/s |  62 kB     00:00    
(3/7): python3-gitdb-4.0.10-3.fc39.noarch.rpm                                                                                                                        832 kB/s | 142 kB     00:00    
(4/7): ninja-build-1.11.1-8.fc39.x86_64.rpm                                                                                                                          1.3 MB/s | 172 kB     00:00    
(5/7): python3-typing-extensions-4.12.2-2.fc39.noarch.rpm                                                                                                            4.8 MB/s |  89 kB     00:00    
(6/7): python3-cmake-build-extension-0.6.0-1.fc39.noarch.rpm                                                                                                         380 kB/s |  32 kB     00:00    
(7/7): python3-GitPython-3.1.40-1.fc39.noarch.rpm                                                                                                                    2.1 MB/s | 381 kB     00:00    
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                1.5 MB/s | 986 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                             1/1 
  Installing       : python3-typing-extensions-4.12.2-2.fc39.noarch                                                                                                                              1/7 
  Installing       : python3-setuptools_scm-7.1.0-7.fc39.noarch                                                                                                                                  2/7 
  Installing       : ninja-build-1.11.1-8.fc39.x86_64                                                                                                                                            3/7 
  Installing       : python3-smmap-5.0.0-6.fc39.noarch                                                                                                                                           4/7 
  Installing       : python3-gitdb-4.0.10-3.fc39.noarch                                                                                                                                          5/7 
  Installing       : python3-GitPython-3.1.40-1.fc39.noarch                                                                                                                                      6/7 
  Installing       : python3-cmake-build-extension-0.6.0-1.fc39.noarch                                                                                                                           7/7 
  Running scriptlet: python3-cmake-build-extension-0.6.0-1.fc39.noarch                                                                                                                           7/7 
  Verifying        : python3-gitdb-4.0.10-3.fc39.noarch                                                                                                                                          1/7 
  Verifying        : python3-setuptools_scm-7.1.0-7.fc39.noarch                                                                                                                                  2/7 
  Verifying        : python3-smmap-5.0.0-6.fc39.noarch                                                                                                                                           3/7 
  Verifying        : ninja-build-1.11.1-8.fc39.x86_64                                                                                                                                            4/7 
  Verifying        : python3-GitPython-3.1.40-1.fc39.noarch                                                                                                                                      5/7 
  Verifying        : python3-cmake-build-extension-0.6.0-1.fc39.noarch                                                                                                                           6/7 
  Verifying        : python3-typing-extensions-4.12.2-2.fc39.noarch                                                                                                                              7/7 

Installed:
  ninja-build-1.11.1-8.fc39.x86_64                  python3-GitPython-3.1.40-1.fc39.noarch        python3-cmake-build-extension-0.6.0-1.fc39.noarch        python3-gitdb-4.0.10-3.fc39.noarch       
  python3-setuptools_scm-7.1.0-7.fc39.noarch        python3-smmap-5.0.0-6.fc39.noarch             python3-typing-extensions-4.12.2-2.fc39.noarch          

Complete!

(.venv) luc@fedora39:~/ComfyUI$ pip install dlib
Collecting dlib
  Using cached dlib-19.24.4.tar.gz (3.3 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: dlib
  Building wheel for dlib (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  Ă— Building wheel for dlib (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [13 lines of output]
      <string>:210: SyntaxWarning: invalid escape sequence '\('
      <string>:211: SyntaxWarning: invalid escape sequence '\('
      <string>:212: SyntaxWarning: invalid escape sequence '\('
      running bdist_wheel
      running build
      running build_ext
      Traceback (most recent call last):
        File "/home/luc/ComfyUI/.venv/bin/cmake", line 5, in <module>
          from cmake import cmake
      ModuleNotFoundError: No module named 'cmake'
      
      ERROR: CMake must be installed to build dlib
      
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for dlib
Failed to build dlib
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (dlib)


At this point I would grab the sources of that package and run its build outside of pip so that I could see it fail and examine the files involved.

Goto the packages PyPI page (usually a web search fpr pypi package works).
You end up here: dlib · PyPI
Check that the project has a recent release and therefore is likely to still work (it does).

From there find its source repo. In this case click on the Homepage link.
That will take you here: GitHub - davisking/dlib: A toolkit for making real world machine learning and data analysis applications in C++
I would git clone the project and follow the README that explains how to build the project.

I’d expect that at some step it will also fail, but you will know the exact step and that will be a lot easier to debug the the pip build.

1 Like

ok will try to do that and let you know , if you feel like knowing what’s happening , thanks a lot

to be honest , i did git clone the repo in my Home folder but now i’m a bit lost on what to do , should i :
Compiling dlib C++ example programs
Compiling your own C++ programs that use dlib
Compiling dlib Python API
Running the unit test suite

sorry i’m such noknowledge in that part

That does make what you trying to do challenging.

Try “Compiling dlib Python API”.

ok lol too bad i tried the “running the unit test suite”
will start again

That should not prevent you doing the other build types one after another.
Did the unit tests pass?

i stopped it , start it again as i need explanation for api
As i understand it i need to create a venv env file in home/dlib
but for this command which version should i use :
python -m build --wheel
pip install dist/dlib- < version > .whl
the test suite is quite slow , sorry

that’s the first part of the suite test

luc@fedora39:~/dlib/dlib/test/build$ cmake ..
-- The C compiler identification is GNU 13.3.1
-- The CXX compiler identification is GNU 13.3.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using CMake version: 3.27.7
-- Compiling dlib version: 19.24.99
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found X11: /usr/include   
-- Looking for XOpenDisplay in /usr/lib64/libX11.so
-- Looking for XOpenDisplay in /usr/lib64/libX11.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
-- Found system copy of libpng: /usr/lib64/libpng.so;/usr/lib64/libz.so
-- Searching for JPEG XL
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.9.5") 
-- Checking for modules 'libjxl;libjxl_cms;libjxl_threads'
--   Package 'libjxl', required by 'virtual:world', not found
--   Package 'libjxl_cms', required by 'virtual:world', not found
--   Package 'libjxl_threads', required by 'virtual:world', not found
 *****************************************************************************
 *** No JPEG XL libraries found.                                           ***
 *** On Ubuntu 23.04 and newer you can install them by executing           ***
 ***    sudo apt install libjxl-dev                                        ***
 ***                                                                       ***
 *** Otherwise, you can find precompiled packages here:                    ***
 ***    https://github.com/libjxl/libjxl/releases                          ***
 *****************************************************************************
-- Searching for BLAS and LAPACK
-- Searching for BLAS and LAPACK
-- Checking for module 'cblas'
--   Package 'cblas', required by 'virtual:world', not found
-- Checking for module 'lapack'
--   Package 'lapack', required by 'virtual:world', not found
-- Looking for cblas_ddot
-- Looking for cblas_ddot - not 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
 *****************************************************************************
 *** No BLAS library found so using dlib's built in BLAS.  However, if you ***
 *** install an optimized BLAS such as OpenBLAS or the Intel MKL your code ***
 *** will run faster.  On Ubuntu you can install OpenBLAS by executing:    ***
 ***    sudo apt-get install libopenblas-dev liblapack-dev                 ***
 *** Or you can easily install OpenBLAS from source by downloading the     ***
 *** source tar file from http://www.openblas.net, extracting it, and      ***
 *** running:                                                              ***
 ***    make; sudo make install                                            ***
 *****************************************************************************
CMake Warning (dev) at /home/luc/dlib/dlib/CMakeLists.txt:652 (find_package):
  Policy CMP0146 is not set: The FindCUDA module is removed.  Run "cmake
  --help-policy CMP0146" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

CUDA_TOOLKIT_ROOT_DIR not found or specified
-- Could NOT find CUDA (missing: CUDA_TOOLKIT_ROOT_DIR CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY) (Required is at least version "7.5")
-- Found CUDA, but CMake was unable to find the cuBLAS libraries that should be part of every basic CUDA install. Your CUDA install is somehow broken or incomplete. Since cuBLAS is required for dlib to use CUDA we won't use CUDA.
-- DID NOT FIND CUDA
-- Disabling CUDA support for dlib.  DLIB WILL NOT USE CUDA
-- Searching for FFMPEG/LIBAV
-- Checking for modules 'libavdevice;libavfilter;libavformat;libavcodec;libswresample;libswscale;libavutil'
--   Package 'libavdevice', required by 'virtual:world', not found
--   Package 'libavfilter', required by 'virtual:world', not found
--   Package 'libavformat', required by 'virtual:world', not found
--   Package 'libavcodec', required by 'virtual:world', not found
--   Package 'libswresample', required by 'virtual:world', not found
--   Package 'libswscale', required by 'virtual:world', not found
--   Package 'libavutil', required by 'virtual:world', not found
 *****************************************************************************
 *** No FFMPEG/LIBAV libraries found.                                      ***
 *** On Ubuntu you can install them by executing                           ***
 ***    sudo apt install libavdevice-dev libavfilter-dev libavformat-dev   ***
 ***    sudo apt install libavcodec-dev libswresample-dev libswscale-dev   ***
 ***    sudo apt install libavutil-dev                                     ***
 *****************************************************************************
OpenCV not found, so we won't build the webcam_face_pose_ex example.
-- Configuring done (3.2s)
-- Generating done (0.3s)
-- Build files have been written to: /home/luc/dlib/dlib/test/build

seems that CUDA tool kit isn’t install , can it be the problem ?
i found that on How to cuda rpm fusion:
sudo dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/fedora39/x86_64/cuda-fedora39.repo
sudo dnf clean all
sudo dnf module disable nvidia-driver
sudo dnf -y install cuda

is there any risk of making pbs with my nvidia drivers ?

At 38% that’s really slow

went all the way without errors
you didn’t answer me for which version to use for the Compiling dlib python API , so i really don’t know how to run it

Still looking for solution

Version of what?

it doesn’t matter as i found the solution. Cmake was already installed thru dnf package , and i was trying to install dlib in my ComfyUI .venv which was needed for face recognition . cmake was also installed thru pip install in my .venv which was the pb. After uninstalling cmake from my .venv i was able to install dlib . I supposed the cmake in venv was conflicting with the one installed with dnf