Can't install dlib even after doing everything

82 Views Asked by At

I'm trying to install DLIB with the following command:

D:\App Setups>pip install dlib

This is the error message I'm getting:

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
  ╰─> [137 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.4 (tags/v3.11.4:d2340ef, Jun  7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)]
      Invoking CMake setup: 'cmake C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\lib.win-amd64-cpython-311 -DPYTHON_EXECUTABLE=C:\Users\UMAR ANSARI\AppData\Local\Programs\Python\Python311\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\lib.win-amd64-cpython-311 -A x64'
      -- Building for: Visual Studio 17 2022
      -- The C compiler identification is MSVC 19.38.33134.0
      -- The CXX compiler identification is MSVC 19.38.33134.0
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - failed
      -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe
      -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe - broken
      CMake Error at C:/Users/UMAR ANSARI/AppData/Local/Temp/pip-build-env-4jab3e7l/overlay/Lib/site-packages/cmake/data/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake:67 (message):
        The C compiler

          "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe"

        is not able to compile a simple test program.

        It fails with the following output:

          Change Dir: 'C:/Users/UMAR ANSARI/AppData/Local/Temp/pip-install-echq3l35/dlib_badbba3058d74568a754fa8fe03b99f7/build/temp.win-amd64-cpython-311/Release/CMakeFiles/CMakeScratch/TryCompile-mrj8j5'

          Run Build Command(s): "C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe" cmTC_fd04b.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=17.0 /v:n
          MSBuild version 17.8.5+b5265ef37 for .NET Framework
          Build started 28-01-2024 18:15:19.

          Project "C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\cmTC_fd04b.vcxproj" on node 1 (default targets).
          PrepareForBuild:
            Creating directory "cmTC_fd04b.dir\Debug\".
            Structured output is enabled. The formatting of compiler diagnostics will reflect the error hierarchy. See https://aka.ms/cpp/structured-output for more details.
            Creating directory "C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\Debug\".
            Creating directory "cmTC_fd04b.dir\Debug\cmTC_fd04b.tlog\".
          InitializeBuildStatus:
            Creating "cmTC_fd04b.dir\Debug\cmTC_fd04b.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
            Touching "cmTC_fd04b.dir\Debug\cmTC_fd04b.tlog\unsuccessfulbuild".
          ClCompile:
            C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\bin\HostX64\x64\CL.exe /c /Zi /W3 /WX- /diagnostics:column /Od /Ob0 /D _MBCS /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_fd04b.dir\Debug\\" /Fd"cmTC_fd04b.dir\Debug\vc143.pdb" /external:W3 /Gd /TC /errorReport:queue "C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\testCCompiler.c"
            Microsoft (R) C/C++ Optimizing Compiler Version 19.38.33134 for x64
            Copyright (C) Microsoft Corporation.  All rights reserved.
            cl /c /Zi /W3 /WX- /diagnostics:column /Od /Ob0 /D _MBCS /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_fd04b.dir\Debug\\" /Fd"cmTC_fd04b.dir\Debug\vc143.pdb" /external:W3 /Gd /TC /errorReport:queue "C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\testCCompiler.c"
            testCCompiler.c
          C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003: The specified task executable "CL.exe" could not be run. System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\cmTC_fd04b.dir\Debug\cmTC_fd04b.tlog'. [C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\cmTC_fd04b.vcxproj]
          C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) [C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\cmTC_fd04b.vcxproj]
          C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at System.IO.FileSystemEnumerableIterator`1.CommonInit() [C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\cmTC_fd04b.vcxproj]
          C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost) [C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\cmTC_fd04b.vcxproj]
          C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at System.IO.Directory.GetFiles(String path, String searchPattern) [C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\cmTC_fd04b.vcxproj]
          C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at Microsoft.Build.Utilities.TrackedDependencies.ExpandWildcards(ITaskItem[] expand) [C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\cmTC_fd04b.vcxproj]
          C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at Microsoft.Build.CPPTasks.TrackedVCToolTask.DeleteFiles(ITaskItem[] filesToDelete) [C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\cmTC_fd04b.vcxproj]
          C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at Microsoft.Build.CPPTasks.CL.PostExecuteTool(Int32 exitCode) [C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\cmTC_fd04b.vcxproj]
          C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at Microsoft.Build.CPPTasks.TrackedVCToolTask.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands) [C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\cmTC_fd04b.vcxproj]
          C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at Microsoft.Build.Utilities.ToolTask.Execute() [C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\cmTC_fd04b.vcxproj]
          Done Building Project "C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\cmTC_fd04b.vcxproj" (default targets) -- FAILED.

          Build FAILED.

          "C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\cmTC_fd04b.vcxproj" (default target) (1) ->
          (ClCompile target) ->
            C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003: The specified task executable "CL.exe" could not be run. System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\cmTC_fd04b.dir\Debug\cmTC_fd04b.tlog'. [C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\cmTC_fd04b.vcxproj]
          C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) [C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\cmTC_fd04b.vcxproj]
          C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at System.IO.FileSystemEnumerableIterator`1.CommonInit() [C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\cmTC_fd04b.vcxproj]
          C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost) [C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\cmTC_fd04b.vcxproj]
          C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at System.IO.Directory.GetFiles(String path, String searchPattern) [C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\cmTC_fd04b.vcxproj]
          C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at Microsoft.Build.Utilities.TrackedDependencies.ExpandWildcards(ITaskItem[] expand) [C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\cmTC_fd04b.vcxproj]
          C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at Microsoft.Build.CPPTasks.TrackedVCToolTask.DeleteFiles(ITaskItem[] filesToDelete) [C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\cmTC_fd04b.vcxproj]
          C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at Microsoft.Build.CPPTasks.CL.PostExecuteTool(Int32 exitCode) [C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\cmTC_fd04b.vcxproj]
          C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at Microsoft.Build.CPPTasks.TrackedVCToolTask.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands) [C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\cmTC_fd04b.vcxproj]
          C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(755,5): error MSB6003:    at Microsoft.Build.Utilities.ToolTask.Execute() [C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-install-echq3l35\dlib_badbba3058d74568a754fa8fe03b99f7\build\temp.win-amd64-cpython-311\Release\CMakeFiles\CMakeScratch\TryCompile-mrj8j5\cmTC_fd04b.vcxproj]

              0 Warning(s)
              1 Error(s)

          Time Elapsed 00:00:01.23





        CMake will not be able to correctly generate this project.
      Call Stack (most recent call first):
        CMakeLists.txt:14 (project)


      -- Configuring incomplete, errors occurred!
      Traceback (most recent call last):
        File "C:\Users\UMAR ANSARI\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\UMAR ANSARI\AppData\Local\Programs\Python\Python311\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:\Users\UMAR ANSARI\AppData\Local\Programs\Python\Python311\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\UMAR ANSARI\AppData\Local\Temp\pip-build-env-4jab3e7l\overlay\Lib\site-packages\setuptools\build_meta.py", line 404, in build_wheel
          return self._build_with_temp_dir(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-build-env-4jab3e7l\overlay\Lib\site-packages\setuptools\build_meta.py", line 389, in _build_with_temp_dir
          self.run_setup()
        File "C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-build-env-4jab3e7l\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 218, in <module>
        File "C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-build-env-4jab3e7l\overlay\Lib\site-packages\setuptools\__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-build-env-4jab3e7l\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-build-env-4jab3e7l\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
          dist.run_commands()
        File "C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-build-env-4jab3e7l\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-build-env-4jab3e7l\overlay\Lib\site-packages\setuptools\dist.py", line 963, in run_command
          super().run_command(command)
        File "C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-build-env-4jab3e7l\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-build-env-4jab3e7l\overlay\Lib\site-packages\wheel\bdist_wheel.py", line 368, in run
          self.run_command("build")
        File "C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-build-env-4jab3e7l\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-build-env-4jab3e7l\overlay\Lib\site-packages\setuptools\dist.py", line 963, in run_command
          super().run_command(command)
        File "C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-build-env-4jab3e7l\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-build-env-4jab3e7l\overlay\Lib\site-packages\setuptools\_distutils\command\build.py", line 131, in run
          self.run_command(cmd_name)
        File "C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-build-env-4jab3e7l\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-build-env-4jab3e7l\overlay\Lib\site-packages\setuptools\dist.py", line 963, in run_command
          super().run_command(command)
        File "C:\Users\UMAR ANSARI\AppData\Local\Temp\pip-build-env-4jab3e7l\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 167, in build_extension
        File "C:\Users\UMAR ANSARI\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\UMAR ANSARI\\AppData\\Local\\Temp\\pip-install-echq3l35\\dlib_badbba3058d74568a754fa8fe03b99f7\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\UMAR ANSARI\\AppData\\Local\\Temp\\pip-install-echq3l35\\dlib_badbba3058d74568a754fa8fe03b99f7\\build\\lib.win-amd64-cpython-311', '-DPYTHON_EXECUTABLE=C:\\Users\\UMAR ANSARI\\AppData\\Local\\Programs\\Python\\Python311\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\UMAR ANSARI\\AppData\\Local\\Temp\\pip-install-echq3l35\\dlib_badbba3058d74568a754fa8fe03b99f7\\build\\lib.win-amd64-cpython-311', '-A', 'x64']' 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

1

There are 1 best solutions below

0
user16171413 On

According to the docs, Either run pip install dlib --verbose or grab the latest sources from github, go to the base folder of the dlib repository, and run python setup.py install. Once either of these commands finishes running you are ready to use dlib from Python. Note that you need to have CMake and a working C++ compiler installed for this to work.

Alternatively, if you want to add more python bindings to dlib's python interface then you probably want to avoid the setup.py file and work directly using CMake. In particular, dlib's python API is built by the CMake project in the tools/python folder. You build this project using the usual CMake commands and when compiled it outputs the dlib shared library that defines the python API for dlib.