davisking / dlib

A toolkit for making real world machine learning and data analysis applications in C++
http://dlib.net
Boost Software License 1.0
13.59k stars 3.38k forks source link

Compiler error C2737 in common.h #2818

Open lnxdx opened 1 year ago

lnxdx commented 1 year ago

What Operating System(s) are you seeing this problem on?

Windows 11

dlib version

19.24.2

Python version

3.10

Compiler

MSVC 19.24.28316 for x64

Expected Behavior

I expect MSVC compiles dlib and produces installable python package.

Current Behavior

When trying to install dlib using pip install dlib command, MSVC report a compiler error C2737 which indicates constexpr object must be initialized. This error occurs on the line number 1040 of common.h file.

This is the full log:

This is the full log:
pip install dlib
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
        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
        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
        gzwrite.c
        infback.c
      C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\zlib\gzread.c(319,20): warning C4267: '=': conversion from 'size_t' to 'unsigned int', possible loss of data [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\zlib\gzread.c(400,35): warning C4267: '=': conversion from 'size_t' to 'unsigned int', possible loss of data [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\zlib\gzread.c(472,33): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\dlib_build\dlib.vcxproj]
        inffast.c
        inflate.c
      C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\zlib\gzwrite.c(212,27): warning C4267: '=': conversion from 'size_t' to 'unsigned int', possible loss of data [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\zlib\gzwrite.c(232,24): warning C4267: '=': conversion from 'size_t' to 'unsigned int', possible loss of data [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\zlib\gzwrite.c(371,36): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\dlib_build\dlib.vcxproj]
        inftrees.c
        trees.c
        uncompr.c
        zutil.c
        jaricom.c
        jcapimin.c
        jcapistd.c
        jcarith.c
        jccoefct.c
        jccolor.c
        jcdctmgr.c
        jchuff.c
        jcinit.c
        jcmainct.c
        jcmarker.c
        jcmaster.c
        jcomapi.c
        jcparam.c
        jcprepct.c
        jcsample.c
        jdapimin.c
        jdapistd.c
        jdarith.c
        jdatadst.c
        jdatasrc.c
        jdcoefct.c
        jdcolor.c
        jddctmgr.c
        jdhuff.c
        jdinput.c
        jdmainct.c
        jdmarker.c
        jdmaster.c
        jdmerge.c
        jdpostct.c
      C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\libjpeg\jdmarker.c(331,1): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_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\string.h(338): message : see declaration of 'strncpy' [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\jdmarker.c(654,1): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_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\string.h(338): message : see declaration of 'strncpy' [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\dlib_build\dlib.vcxproj]
        jdsample.c
        jerror.c
        jfdctflt.c
      C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\libjpeg\jerror.c(194,1): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.jfdctfst.c [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(1774): message : see declaration of 'sprintf' [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\dlib_build\dlib.vcxproj]
        jfdctint.c
      C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\dlib\external\libjpeg\jerror.c(196,1): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_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]
        jidctflt.c
      C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(1774): message : see declaration of 'sprintf' [C:\Users\M\AppData\Local\Temp\pip-install-9w773etl\dlib_23f269c253c1473abb630c0d026c8554\build\temp.win-amd64-cpython-310\Release\dlib_build\dlib.vcxproj]
        jidctfst.c
        jidctint.c
        jmemmgr.c
        jmemnobs.c
        jquant1.c
        jquant2.c
      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

Steps to Reproduce

pip install dlib Note that CMake is installed and is in PATH.

Anything else?

After unsuccessful installation for dlib 19.24.2, I finally downloaded dlib 19.24.0 from dlib website and installed it without producing any error. Note that the line which produces said error does not exist in version 19.24.0.

lnxdx commented 1 year ago

pip install dlib==19.24.0 works. But pip install dlib==19.24.2 doesn't!

davisking commented 1 year ago

That version of visual studio is too old. Try using a newer one like Visual Studio 17.