pythonc++pipdlib

How to install dlib using pip on windows 11 for python 3.10.5


I've spent two days trying to install dlib using pip on windows 11 for python 3.10.5 without any success.

I have installed C++ development tools using Visual Studio 2019 installer and cl.exe is in the PATH.

I have also installed Cmake from cmake.org and it's binary is in the path.

I have also installed cmake module for python using pip. But every time I try to install dlib it gives me the following error. I have also tried installing using python setup.py install. dlib version download from PyPi repository is 19.24.2.

Collecting dlib
 Using cached dlib-19.24.2.tar.gz (11.8 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
 ╰─> [319 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.10.5 (tags/v3.10.5:f377153, Jun  6 2022, 16:14:13) [MSC v.1929 64 bit (AMD64)]
     Invoking CMake setup: 'cmake C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\lib.win-amd64-cpython-310 -DPYTHON_EXECUTABLE=C:\Program Files\Python310\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\lib.win-amd64-cpython-310 -A x64'
     -- Building for: Visual Studio 16 2019
     -- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.22621.
     -- The C compiler identification is MSVC 19.24.28316.0
     -- The CXX compiler identification is MSVC 19.24.28316.0
     -- Detecting C compiler ABI info
     -- Detecting C compiler ABI info - done
     -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/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/2019/Community/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe - skipped
     -- Detecting CXX compile features
     -- Detecting CXX compile features - done
     -- pybind11 v2.10.0
     -- Found PythonInterp: C:/Program Files/Python310/python.exe (found suitable version "3.10.5", minimum required is "3.6")
     -- Found PythonLibs: C:/Program Files/Python310/libs/python310.lib
     -- Performing Test HAS_MSVC_GL_LTCG
     -- Performing Test HAS_MSVC_GL_LTCG - Success
     -- Using CMake version: 3.26.4
     -- Compiling dlib version: 19.24.2
     -- 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 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
     -- Could NOT find CUDA (missing: CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY) (found suitable version "12.0", minimum required is "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 (16.4s)
     -- Generating done (0.1s)
     -- Build files have been written to: C:/Users/M/AppData/Local/Temp/pip-install-9w773etl/dlib_23f269c253c1473abb630c0d026c8554/build/temp.win-amd64-cpython-310/Release
     Invoking CMake build: 'cmake --build . --config Release -- /m'
     Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Framework
     Copyright (C) Microsoft Corporation. All rights reserved.

     C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(467,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:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\ZERO_CHECK.vcxproj]
       Checking Build System
     C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(467,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:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\dlib_build\dlib.vcxproj]
       Building Custom Rule C:/Users/M/AppData/Local/Temp/pip-install-9w773etl/dlib_23f269c253c1473abb630c0d026c8554/dlib/CMakeLists.txt
       [*** SOME CPP FILES ***]
       [*** SOME C   FILES ***]
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\libjpeg\jmemmgr.c(1103,1): warning C4996: 'getenv': This function or variable may be unsafe. Consider using _dupenv_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\dlib_build\dlib.vcxproj]
     C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdlib.h(1191): message : see declaration of 'getenv' [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\dlib_build\dlib.vcxproj]
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\libjpeg\jmemmgr.c(1106,1): warning C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\dlib_build\dlib.vcxproj]
     C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(2263): message : see declaration of 'sscanf' [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\dlib_build\dlib.vcxproj]
       jutils.c
       dlib.vcxproj -> C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\dlib_build\Release\dlib19.24.2_release_64bit_msvc1924.lib
     C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(467,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:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
       Building Custom Rule C:/Users/M/AppData/Local/Temp/pip-install-9w773etl/dlib_23f269c253c1473abb630c0d026c8554/tools/python/CMakeLists.txt
       dlib.cpp
       matrix.cpp
       vector.cpp
       svm_c_trainer.cpp
       svm_rank_trainer.cpp
       decision_functions.cpp
       other.cpp
       basic.cpp
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\pybind11\include\pybind11\detail/common.h(1040,54): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized (compiling source file C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python\src\decision_functions.cpp) [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\pybind11\include\pybind11\detail/common.h(1040,54): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized (compiling source file C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python\src\matrix.cpp) [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\pybind11\include\pybind11\detail/common.h(1040,54): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized (compiling source file C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python\src\svm_rank_trainer.cpp) [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\pybind11\include\pybind11\detail/common.h(1040,54): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized (compiling source file C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python\src\svm_c_trainer.cpp) [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\pybind11\include\pybind11\detail/common.h(1040,54): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized (compiling source file C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python\src\basic.cpp) [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\pybind11\include\pybind11\detail/common.h(1040,54): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized (compiling source file C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python\src\vector.cpp) [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\pybind11\include\pybind11\detail/common.h(1040,54): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized (compiling source file C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python\src\dlib.cpp) [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\pybind11\include\pybind11\detail/common.h(1040,54): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized (compiling source file C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python\src\other.cpp) [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
       cca.cpp
       sequence_segmenter.cpp
       svm_struct.cpp
       image.cpp
       image2.cpp
       image3.cpp
       image4.cpp
       rectangles.cpp
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\pybind11\include\pybind11\detail/common.h(1040,54): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized (compiling source file C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python\src\cca.cpp) [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\pybind11\include\pybind11\detail/common.h(1040,54): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized (compiling source file C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python\src\sequence_segmenter.cpp) [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\pybind11\include\pybind11\detail/common.h(1040,54): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized (compiling source file C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python\src\svm_struct.cpp) [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\pybind11\include\pybind11\detail/common.h(1040,54): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized (compiling source file C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python\src\image.cpp) [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\pybind11\include\pybind11\detail/common.h(1040,54): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized (compiling source file C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python\src\image2.cpp) [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\pybind11\include\pybind11\detail/common.h(1040,54): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized (compiling source file C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python\src\image3.cpp) [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\pybind11\include\pybind11\detail/common.h(1040,54): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized (compiling source file C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python\src\image4.cpp) [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\pybind11\include\pybind11\detail/common.h(1040,54): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized (compiling source file C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python\src\rectangles.cpp) [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
       object_detection.cpp
       shape_predictor.cpp
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\pybind11\include\pybind11\detail/common.h(1040,54): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized (compiling source file C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python\src\object_detection.cpp) [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
       correlation_tracker.cpp
       face_recognition.cpp
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\pybind11\include\pybind11\detail/common.h(1040,54): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized (compiling source file C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python\src\shape_predictor.cpp) [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
       cnn_face_detector.cpp
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\pybind11\include\pybind11\detail/common.h(1040,54): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized (compiling source file C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python\src\correlation_tracker.cpp) [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\pybind11\include\pybind11\detail/common.h(1040,54): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized (compiling source file C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python\src\face_recognition.cpp) [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
       global_optimization.cpp
       image_dataset_metadata.cpp
       numpy_returns.cpp
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\pybind11\include\pybind11\detail/common.h(1040,54): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized (compiling source file C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python\src\cnn_face_detector.cpp) [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\pybind11\include\pybind11\detail/common.h(1040,54): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized (compiling source file C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python\src\global_optimization.cpp) [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\pybind11\include\pybind11\detail/common.h(1040,54): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized (compiling source file C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python\src\image_dataset_metadata.cpp) [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\pybind11\include\pybind11\detail/common.h(1040,54): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized (compiling source file C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python\src\numpy_returns.cpp) [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
       line.cpp
       gui.cpp
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\pybind11\include\pybind11\detail/common.h(1040,54): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized (compiling source file C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python\src\line.cpp) [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
     C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\pybind11\include\pybind11\detail/common.h(1040,54): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized (compiling source file C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\tools\python\src\gui.cpp) [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\_dlib_pybind11.vcxproj]
     Traceback (most recent call last):
       File "C:\Program Files\Python310\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
         main()
       File "C:\Program Files\Python310\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
         json_out['return_val'] = hook(**hook_input['kwargs'])
       File "C:\Program Files\Python310\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 251, in build_wheel
         return _build_backend().build_wheel(wheel_directory, config_settings,
       File "C:\Users\M\AppData\Local\Temp\pip-build-env-456v1vww\overlay\Lib\site-packages\setuptools\build_meta.py", line 416, in build_wheel
         return self._build_with_temp_dir(['bdist_wheel'], '.whl',
       File "C:\Users\M\AppData\Local\Temp\pip-build-env-456v1vww\overlay\Lib\site-packages\setuptools\build_meta.py", line 401, in _build_with_temp_dir
         self.run_setup()
       File "C:\Users\M\AppData\Local\Temp\pip-build-env-456v1vww\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in run_setup
         exec(code, locals())
       File "<string>", line 218, in <module>
       File "C:\Users\M\AppData\Local\Temp\pip-build-env-456v1vww\overlay\Lib\site-packages\setuptools\__init__.py", line 107, in setup
         return distutils.core.setup(**attrs)
       File "C:\Users\M\AppData\Local\Temp\pip-build-env-456v1vww\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
         return run_commands(dist)
       File "C:\Users\M\AppData\Local\Temp\pip-build-env-456v1vww\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
         dist.run_commands()
       File "C:\Users\M\AppData\Local\Temp\pip-build-env-456v1vww\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
         self.run_command(cmd)
       File "C:\Users\M\AppData\Local\Temp\pip-build-env-456v1vww\overlay\Lib\site-packages\setuptools\dist.py", line 1234, in run_command
         super().run_command(command)
       File "C:\Users\M\AppData\Local\Temp\pip-build-env-456v1vww\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
         cmd_obj.run()
       File "C:\Users\M\AppData\Local\Temp\pip-build-env-456v1vww\overlay\Lib\site-packages\wheel\bdist_wheel.py", line 343, in run
         self.run_command("build")
       File "C:\Users\M\AppData\Local\Temp\pip-build-env-456v1vww\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
         self.distribution.run_command(command)
       File "C:\Users\M\AppData\Local\Temp\pip-build-env-456v1vww\overlay\Lib\site-packages\setuptools\dist.py", line 1234, in run_command
         super().run_command(command)
       File "C:\Users\M\AppData\Local\Temp\pip-build-env-456v1vww\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
         cmd_obj.run()
       File "C:\Users\M\AppData\Local\Temp\pip-build-env-456v1vww\overlay\Lib\site-packages\setuptools\_distutils\command\build.py", line 131, in run
         self.run_command(cmd_name)
       File "C:\Users\M\AppData\Local\Temp\pip-build-env-456v1vww\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
         self.distribution.run_command(command)
       File "C:\Users\M\AppData\Local\Temp\pip-build-env-456v1vww\overlay\Lib\site-packages\setuptools\dist.py", line 1234, in run_command
         super().run_command(command)
       File "C:\Users\M\AppData\Local\Temp\pip-build-env-456v1vww\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
         cmd_obj.run()
       File "<string>", line 130, in run
       File "<string>", line 170, in build_extension
       File "C:\Program Files\Python310\lib\subprocess.py", line 369, 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```

Please help me!

Solution

  • I installed a lower version of dlib (19.24.0) and it works.