Why am I having this issuse while Installing dlib

I am doing a project which requires the face-recognition library for which dlib was needed.

I am having an issue installing “dlib” for a project. The terminal is throwing the following error

  error: subprocess-exited-with-error

  × Building wheel for dlib (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [392 lines of output]
      running bdist_wheel
      running build
      running build_ext
      <string>:125: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
      Building extension for Python 3.11.9 (tags/v3.11.9:de54cf5, Apr  2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:UsersLENOVOAppDataLocalTemppip-install-n0wf3b9rdlib_94f3ffa0c38b412abab68539f53bd7betoolspython -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:UsersLENOVOAppDataLocalTemppip-install-n0wf3b9rdlib_94f3ffa0c38b412abab68539f53bd7bebuildlib.win-amd64-cpython-311 -DPYTHON_EXECUTABLE=C:UsersLENOVOAppDataLocalMicrosoftWindowsAppsPythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:UsersLENOVOAppDataLocalTemppip-install-n0wf3b9rdlib_94f3ffa0c38b412abab68539f53bd7bebuildlib.win-amd64-cpython-311 -A x64'
      -- Building for: Visual Studio 17 2022
      -- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631.
      -- The C compiler identification is MSVC 19.40.33811.0     
      -- The CXX compiler identification is MSVC 19.40.33811.0   
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe - 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: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      CMake Deprecation Warning at C:/Users/LENOVO/AppData/Local/Temp/pip-install-n0wf3b9r/dlib_94f3ffa0c38b412abab68539f53bd7be/dlib/external/pybind11/CMakeLists.txt:8 (cmake_minimum_required): 
        Compatibility with CMake < 3.5 will be removed from a future version of
        CMake.

        Update the VERSION argument <min> value or use a ...<max> suffix to tell
        CMake that the project does not need compatibility with older versions.


      -- pybind11 v2.10.0
      CMake Warning (dev) at C:/Users/LENOVO/AppData/Local/Temp/pip-install-n0wf3b9r/dlib_94f3ffa0c38b412abab68539f53bd7be/dlib/external/pybind11/tools/FindPythonLibsNew.cmake:98 (find_package): 
        Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
        are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
        the cmake_policy command to set the policy and suppress this warning.

      Call Stack (most recent call first):
        C:/Users/LENOVO/AppData/Local/Temp/pip-install-n0wf3b9r/dlib_94f3ffa0c38b412abab68539f53bd7be/dlib/external/pybind11/tools/pybind11Tools.cmake:50 (find_package)
        C:/Users/LENOVO/AppData/Local/Temp/pip-install-n0wf3b9r/dlib_94f3ffa0c38b412abab68539f53bd7be/dlib/external/pybind11/tools/pybind11Common.cmake:180 (include)
        C:/Users/LENOVO/AppData/Local/Temp/pip-install-n0wf3b9r/dlib_94f3ffa0c38b412abab68539f53bd7be/dlib/external/pybind11/CMakeLists.txt:200 (include)
      This warning is for project developers.  Use -Wno-dev to suppress it.

      -- Found PythonInterp: C:/Users/LENOVO/AppData/Local/Microsoft/WindowsApps/PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0/python.exe (found suitable version "3.11.9", minimum required is "3.6")
      -- Found PythonLibs: C:/Program Files/WindowsApps/PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0/libs/python311.lib
      -- Performing Test HAS_MSVC_GL_LTCG
      -- Performing Test HAS_MSVC_GL_LTCG - Success
      -- Using CMake version: 3.30.0-rc1
      -- Compiling dlib version: 19.24.4
      -- 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
      -- Enabling SSE2 instructions
      -- Searching for JPEG XL
      -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
      -- PkgConfig could not be found, JPEG XL support won't be available
      -- Searching for BLAS and LAPACK
      -- Searching for BLAS and LAPACK
      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed        
      -- 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 - not found       
      -- Found Threads: TRUE
      CMake Warning (dev) at C:/Users/LENOVO/AppData/Local/Temp/pip-install-n0wf3b9r/dlib_94f3ffa0c38b412abab68539f53bd7be/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
      -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
      -- PkgConfig could not be found, FFMPEG won't be available 
      -- Configuring done (152.3s)
      -- Generating done (0.2s)
      -- Build files have been written to: C:/Users/LENOVO/AppData/Local/Temp/pip-install-n0wf3b9r/dlib_94f3ffa0c38b412abab68539f53bd7be/build/temp.win-amd64-cpython-311/Release
      Invoking CMake build: 'cmake --build . --config Release -- /m'
      MSBuild version 17.10.4+10fbfbf2e for .NET Framework       

      C:Program Files (x86)Microsoft Visual Studio2022BuildToolsMSBuildMicrosoftVCv170Microsoft.CppBuild.targets(541,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:UsersLENOVOAppDataLocalTemppip-install-n0wf3b9rdlib_94f3ffa0c38b412abab68539f53bd7bebuildtemp.win-amd64-cpython-311ReleaseZERO_CHECK.vcxproj]
        1>Checking Build System
      C:Program Files (x86)Microsoft Visual Studio2022BuildToolsMSBuildMicrosoftVCv170Microsoft.CppBuild.targets(541,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:UsersLENOVOAppDataLocalTemppip-install-n0wf3b9rdlib_94f3ffa0c38b412abab68539f53bd7bebuildtemp.win-amd64-cpython-311Releasedlib_builddlib.vcxproj]      
        Building Custom Rule C:/Users/LENOVO/AppData/Local/Temp/pip-install-n0wf3b9r/dlib_94f3ffa0c38b412abab68539f53bd7be/dlib/CMakeLists.txt
        base64_kernel_1.cpp
        bigint_kernel_1.cpp
        bigint_kernel_2.cpp
        bit_stream_kernel_1.cpp
        entropy_decoder_kernel_1.cpp
        entropy_decoder_kernel_2.cpp
        entropy_encoder_kernel_1.cpp
        entropy_encoder_kernel_2.cpp
        md5_kernel_1.cpp
        tokenizer_kernel_1.cpp
        unicode.cpp
        test_for_odr_violations.cpp
        fft.cpp
        sockets_kernel_1.cpp
        bsp.cpp
        dir_nav_kernel_1.cpp
        dir_nav_kernel_2.cpp
        dir_nav_extensions.cpp
        fonts.cpp
        linker_kernel_1.cpp
        extra_logger_headers.cpp
        logger_kernel_1.cpp
        logger_config_file.cpp
        misc_api_kernel_1.cpp
        misc_api_kernel_2.cpp
        sockets_extensions.cpp
        sockets_kernel_2.cpp
        sockstreambuf.cpp
        sockstreambuf_unbuffered.cpp
        server_kernel.cpp
        server_iostream.cpp
        server_http.cpp
        multithreaded_object_extension.cpp
        threaded_object_extension.cpp
        threads_kernel_1.cpp
        threads_kernel_2.cpp
        threads_kernel_shared.cpp
        thread_pool_extension.cpp
        async.cpp
        timer.cpp
        stack_trace.cpp
        cpu_dlib.cpp
        tensor_tools.cpp
        image_dataset_metadata.cpp
        mnist.cpp
        cifar.cpp
        global_function_search.cpp
      C:UsersLENOVOAppDataLocalTemppip-install-n0wf3b9rdlib_94f3ffa0c38b412abab68539f53bd7bedlibgeometryrectangle.h(164,1): warning C4723: potential divide by 0 [C:UsersLENOVOAppDataLocalTemppip-install-n0wf3b9rdlib_94f3ffa0c38b412abab68539f53bd7bebuildtemp.win-amd64-cpython-311Releasedlib_builddlib.vcxproj]
        kalman_filter.cpp
        auto.cpp
        widgets.cpp
        drawable.cpp
        canvas_drawing.cpp
        style.cpp
        base_widgets.cpp
        gui_core_kernel_1.cpp
        gui_core_kernel_2.cpp
        png_loader.cpp
        save_png.cpp
        jpeg_loader.cpp
        save_jpeg.cpp
        arm_init.c
        filter_neon_intrinsics.c
        palette_neon_intrinsics.c
        png.c
        pngerror.c
        pngget.c
        pngmem.c
        pngpread.c
        pngread.c
        pngrio.c
        pngrtran.c
        pngrutil.c
        pngset.c
        pngtrans.c
        pngwio.c
        pngwrite.c
        pngwtran.c
        pngwutil.c
        adler32.c
        compress.c
        crc32.c
        deflate.c
        gzclose.c
        gzlib.c
        gzread.c
.
.
.
.
.
        File "<string>", line 130, in run
        File "<string>", line 170, in build_extension     
        File "C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0Libsubprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '/m']' returned non-zero exit status 1.
      [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: Could not build wheels for dlib, which is required to install pyproject.toml-based projects

The install process always gets stuck on “Building wheel for dlib(pyproject.toml)” for 5 min or so and then throws this gigantic error. I am not able to understand and comprehend what the error says but have tried number of ways to solve it but nothing has worked.

I have tried every option that I found online like creating a virtual environment, installing the .exe file of dlib from github, reinstalling cmake and even tried changing python version to 3.9.11 but the problem still persists.

Thought it was problem with pip so upgraded it too and have tried both pip and pip3, both are not working.

Though I was able to install it through the virtual environment, it had problems in importing the modules.

So if any other suggestions you’ll have or is their a problem with my system.

The Python version I am currently working on is 3.11.9.

P.S. – couldn’t copy the whole error since it was exceeding the body word limit.

New contributor

pd_prince is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật