title: Failed Run MSBuild while install dlib in python
body: <p>I'm trying to load a facial recognition project, but when I install dlib I get an error. But when i install other packages it's fine. I only get this error message when installing dlib and face-recognition packages</p>
  <pre><code>          Preparing metadata (setup.py) ... done
          Building wheels for collected packages: dlib
            Building wheel for dlib (setup.py) ... error
            error: subprocess-exited-with-error
            
            × python setup.py bdist_wheel did not run successfully.
            │ exit code: 1
            ╰─&gt; [96 lines of output]
                running bdist_wheel
                running build
                running build_py
                package init file 'tools\python\dlib\__init__.py' not found (or not a regular file)
                running build_ext
                C:\Users\ASUS\AppData\Local\Temp\pip-install-r9702w1f\dlib_1bf6b6082f92416c881908acef36aebf\setup.py:129: DeprecationWarning: distutils Version classes are depr
          ecated. Use packaging.version instead.
                  if LooseVersion(cmake_version) &lt; '3.1.0':
                Building extension for Python 3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:19:38) [MSC v.1929 64 bit (AMD64)]
                Invoking CMake setup: 'cmake C:\Users\ASUS\AppData\Local\Temp\pip-install-r9702w1f\dlib_1bf6b6082f92416c881908acef36aebf\tools\python -DCMAKE_LIBRARY_OUTPUT_DIR
          ECTORY=C:\Users\ASUS\AppData\Local\Temp\pip-install-r9702w1f\dlib_1bf6b6082f92416c881908acef36aebf\build\lib.win-amd64-3.9 -DPYTHON_EXECUTABLE=C:\Users\ASUS\PycharmPr
          ojects\Testing\venv\Scripts\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\ASUS\AppData\Local\Temp\pip-install-r9702w1f\dlib_1bf6b6082f92416c881908acef3
          6aebf\build\lib.win-amd64-3.9 -A x64'
                -- Building for: Visual Studio 17 2022
                -- Selecting Windows SDK version 10.0.19041.0 to
  
   target Windows 10.0.19044.
            CMake Error at CMakeLists.txt:14 (project):
              Failed to run MSBuild command:
           
                E:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe
           
              to get the value of VCTargetsPath:
           
                Microsoft (R) Build Engine version 17.1.0+ae57d105c for .NET Framework
           
                Copyright (C) Microsoft Corporation. All rights reserved.
           
            
           
                Build started 13/04/2022 17:07:52.
           
                Project &quot;C:\Users\ASUS\AppData\Local\Temp\pip-install-r9702w1f\dlib_1bf6b6082f92416c881908acef36aebf\build\temp.win-amd64-3.9\Release\CMakeFiles\3.21.0\VCTa
      rgetsPath.vcxproj&quot; on node 1 (default targets).
           
                E:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(440,5): error MSB8020: The build tools for Visu
      al Studio 2019 (Platform Toolset = 'v142') cannot be found. To build using the v142 build tools, please install Visual Studio 2019 build tools.  Alternatively, you ma
      y upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting &quot;Retarget solution&quot;. [C:\Users\ASUS\AppData
      \Local\Temp\pip-install-r9702w1f\dlib_1bf6b6082f92416c881908acef36aebf\build\temp.win-amd64-3.9\Release\CMakeFiles\3.21.0\VCTargetsPath.vcxproj]
           
                Done Building Project &quot;C:\Users\ASUS\AppData\Local\Temp\pip-install-r9702w1f\dlib_1bf6b6082f92416c881908acef36aebf\build\temp.win-amd64-3.9\Release\CMakeFil
      es\3.21.0\VCTargetsPath.vcxproj&quot; (default targets) -- FAILED.
           
           
                       
  </code></pre>
  <p>I use python 3.9 and pip 22.0.4</p>
  <p>How can I solve this?</p>