title: dlib installation error for Python 3.9.1. How to know which version is compatible?
body: <p>I have already installed CMake and now am trying to install dlib for a face recognition project. I have seen some videos and the issue seems to be from compatibility issues. For Python 3.9.1 which version of dlib is more compatible?  I have tried using pip to install dlib, manually downloaded it and still it is showing the following error:</p>
  <pre><code>WARNING: Value for scheme.headers does not match. Please report this to &lt;https://github.com/pypa/pip/issues/9617&gt;
  distutils: c:\users\aviparna.biswas\appdata\local\programs\python\python39\Include\UNKNOWN
  sysconfig: c:\users\aviparna.biswas\appdata\local\programs\python\python39\Include
  WARNING: Additional context:
  user = False
  home = None
  root = None
  prefix = None
  Collecting dlib
    Using cached dlib-19.22.0.tar.gz (7.4 MB)
  Building wheels for collected packages: dlib
    Building wheel for dlib (setup.py) ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\aviparna.biswas\appdata\local\programs\python\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '&quot;'&quot;'C:\\Users\\aviparna.biswas\\AppData\\Local\\Temp\\pip-install-1u1dh1_j\\dlib_0e99482dc2db4cb5a05e1507ea95d200\\setup.py'&quot;'&quot;'; __file__='&quot;'&quot;'C:\\Users\\aviparna.biswas\\AppData\\Local\\Temp\\pip-install-1u1dh1_j\\dlib_0e99482dc2db4cb5a05e1507ea95d200\\setup.py'&quot;'&quot;';f = getattr(tokenize, '&quot;'&quot;'open'&quot;'&quot;', open)(__file__) if os.path.exists(__file__) else io.StringIO('&quot;'&quot;'from setuptools import setup; setup()'&quot;'&quot;');code = f.read().replace('&quot;'&quot;'\r\n'&quot;'&quot;', '&quot;'&quot;'\n'&quot;'&quot;');f.close();exec(compile(code, __file__, '&quot;'&quot;'exec'&quot;'&quot;'))' bdist_wheel -d 'C:\Users\aviparna.biswas\AppData\Local\Temp\pip-wheel-nx3osnd3'  
         cwd: C:\Users\aviparna.biswas\AppData\Local\Temp\pip-install-1u1dh1_j\dlib_0e99482dc2db4cb5a05e1507ea95d200\
    Complete output (58 lines):
    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
    Building extension for Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec  7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)]
    Invoking CMake setup: 'cmake C:\Users\aviparna.biswas\AppData\Local\Temp\pip-install-1u1dh1_j\dlib_0e99482dc2db4cb5a05e1507ea95d200\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\aviparna.biswas\AppData\Local\Temp\pip-install-1u1dh1_j\dlib_0e99482dc2db4cb5a05e1507ea95d200\build\lib.win-amd64-3.9 -DPYTHON_EXECUTABLE=c:\users\aviparna.biswas\appdata\local\programs\python\python39\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\aviparna.biswas\AppData\Local\Temp\pip-install-1u1dh1_j\dlib_0e99482dc2db4cb5a05e1507ea95d200\build\lib.win-amd64-3.9 -A x64'
    -- Building for: NMake Makefiles
    CMake Error at CMakeLists.txt:5 (message):
  
  
  
      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  
  
      You must use Visual Studio to build a python extension on windows.  If you
      are getting this error it means you have not installed Visual C++.  Note
      that there are many flavors of Visual Studio, like Visual Studio for C#
      development.  You need to install Visual Studio for C++.
  
  
      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  
  
  
  
    -- Configuring incomplete, errors occurred!
    Traceback (most recent call last):
      File &quot;&lt;string&gt;&quot;, line 1, in &lt;module&gt;
      File &quot;C:\Users\aviparna.biswas\AppData\Local\Temp\pip-install-1u1dh1_j\dlib_0e99482dc2db4cb5a05e1507ea95d200\setup.py&quot;, line 222, in &lt;module&gt;
        setup(
      File &quot;c:\users\aviparna.biswas\appdata\local\programs\python\python39\lib\site-packages\setuptools\__init__.py&quot;, line 165, 
  in setup
        return distutils.core.setup(**attrs)
      File &quot;c:\users\aviparna.biswas\appdata\local\programs\python\python39\lib\distutils\core.py&quot;, line 148, in setup
        dist.run_commands()
      File &quot;c:\users\aviparna.biswas\appdata\local\programs\python\python39\lib\distutils\dist.py&quot;, line 966, in run_commands    
        self.run_command(cmd)
      File &quot;c:\users\aviparna.biswas\appdata\local\programs\python\python39\lib\distutils\dist.py&quot;, line 985, in run_command     
        cmd_obj.run()
      File &quot;c:\users\aviparna.biswas\appdata\local\programs\python\python39\lib\site-packages\wheel\bdist_wheel.py&quot;, line 299, in run
        self.run_command('build')
      File &quot;c:\users\aviparna.biswas\appdata\local\programs\python\python39\lib\distutils\cmd.py&quot;, line 313, in run_command      
        self.distribution.run_command(command)
      File &quot;c:\users\aviparna.biswas\appdata\local\programs\python\python39\lib\distutils\dist.py&quot;, line 985, in run_command     
        cmd_obj.run()
      File &quot;c:\users\aviparna.biswas\appdata\local\programs\python\python39\lib\distutils\command\build.py&quot;, line 135, in run    
        self.run_command(cmd_name)
      File &quot;c:\users\aviparna.biswas\appdata\local\programs\python\python39\lib\distutils\cmd.py&quot;, line 313, in run_command      
        self.distribution.run_command(command)
      File &quot;c:\users\aviparna.biswas\appdata\local\programs\python\python39\lib\distutils\dist.py&quot;, line 985, in run_command     
        cmd_obj.run()
      File &quot;C:\Users\aviparna.biswas\AppData\Local\Temp\pip-install-1u1dh1_j\dlib_0e99482dc2db4cb5a05e1507ea95d200\setup.py&quot;, line 134, in run
        self.build_extension(ext)
      File &quot;C:\Users\aviparna.biswas\AppData\Local\Temp\pip-install-1u1dh1_j\dlib_0e99482dc2db4cb5a05e1507ea95d200\setup.py&quot;, line 171, in build_extension
        subprocess.check_call(cmake_setup, cwd=build_folder)
      File &quot;c:\users\aviparna.biswas\appdata\local\programs\python\python39\lib\subprocess.py&quot;, line 373, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\aviparna.biswas\\AppData\\Local\\Temp\\pip-install-1u1dh1_j\\dlib_0e99482dc2db4cb5a05e1507ea95d200\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\aviparna.biswas\\AppData\\Local\\Temp\\pip-install-1u1dh1_j\\dlib_0e99482dc2db4cb5a05e1507ea95d200\\build\\lib.win-amd64-3.9', '-DPYTHON_EXECUTABLE=c:\\users\\aviparna.biswas\\appdata\\local\\programs\\python\\python39\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\aviparna.biswas\\AppData\\Local\\Temp\\pip-install-1u1dh1_j\\dlib_0e99482dc2db4cb5a05e1507ea95d200\\build\\lib.win-amd64-3.9', '-A', 'x64']' returned non-zero exit status 1.
    ----------------------------------------
    ERROR: Failed building wheel for dlib
    Running setup.py clean for dlib
  Failed to build dlib
  Installing collected packages: dlib
      Running setup.py install for dlib ... error
      ERROR: Command errored out with exit status 1:
       command: 'c:\users\aviparna.biswas\appdata\local\programs\python\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '&quot;'&quot;'C:\\Users\\aviparna.biswas\\AppData\\Local\\Temp\\pip-install-1u1dh1_j\\dlib_0e99482dc2db4cb5a05e1507ea95d200\\setup.py'&quot;'&quot;'; __file__='&quot;'&quot;'C:\\Users\\aviparna.biswas\\AppData\\Local\\Temp\\pip-install-1u1dh1_j\\dlib_0e99482dc2db4cb5a05e1507ea95d200\\setup.py'&quot;'&quot;';f = getattr(tokenize, '&quot;'&quot;'open'&quot;'&quot;', open)(__file__) if os.path.exists(__file__) else io.StringIO('&quot;'&quot;'from setuptools import setup; setup()'&quot;'&quot;');code = f.read().replace('&quot;'&quot;'\r\n'&quot;'&quot;', '&quot;'&quot;'\n'&quot;'&quot;');f.close();exec(compile(code, __file__, '&quot;'&quot;'exec'&quot;'&quot;'))' install --record 'C:\Users\aviparna.biswas\AppData\Local\Temp\pip-record-prgz7cvz\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\aviparna.biswas\appdata\local\programs\python\python39\Include\dlib'
           cwd: C:\Users\aviparna.biswas\AppData\Local\Temp\pip-install-1u1dh1_j\dlib_0e99482dc2db4cb5a05e1507ea95d200\
      Complete output (60 lines):
      running install
      running build
      running build_py
      package init file 'tools\python\dlib\__init__.py' not found (or not a regular file)
      running build_ext
      Building extension for Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec  7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)]
      Invoking CMake setup: 'cmake C:\Users\aviparna.biswas\AppData\Local\Temp\pip-install-1u1dh1_j\dlib_0e99482dc2db4cb5a05e1507ea95d200\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\aviparna.biswas\AppData\Local\Temp\pip-install-1u1dh1_j\dlib_0e99482dc2db4cb5a05e1507ea95d200\build\lib.win-amd64-3.9 -DPYTHON_EXECUTABLE=c:\users\aviparna.biswas\appdata\local\programs\python\python39\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\aviparna.biswas\AppData\Local\Temp\pip-install-1u1dh1_j\dlib_0e99482dc2db4cb5a05e1507ea95d200\build\lib.win-amd64-3.9 -A x64'
      -- Building for: NMake Makefiles
      CMake Error at CMakeLists.txt:5 (message):
  
  
  
        !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  
  
        You must use Visual Studio to build a python extension on windows.  If you
        are getting this error it means you have not installed Visual C++.  Note
        that there are many flavors of Visual Studio, like Visual Studio for C#
        development.  You need to install Visual Studio for C++.
  
  
        !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  
  
  
  
      -- Configuring incomplete, errors occurred!
      Traceback (most recent call last):
        File &quot;&lt;string&gt;&quot;, line 1, in &lt;module&gt;
        File &quot;C:\Users\aviparna.biswas\AppData\Local\Temp\pip-install-1u1dh1_j\dlib_0e99482dc2db4cb5a05e1507ea95d200\setup.py&quot;, line 222, in &lt;module&gt;
          setup(
        File &quot;c:\users\aviparna.biswas\appdata\local\programs\python\python39\lib\site-packages\setuptools\__init__.py&quot;, line 165, in setup
          return distutils.core.setup(**attrs)
        File &quot;c:\users\aviparna.biswas\appdata\local\programs\python\python39\lib\distutils\core.py&quot;, line 148, in setup
          dist.run_commands()
        File &quot;c:\users\aviparna.biswas\appdata\local\programs\python\python39\lib\distutils\dist.py&quot;, line 966, in run_commands  
          self.run_command(cmd)
        File &quot;c:\users\aviparna.biswas\appdata\local\programs\python\python39\lib\distutils\dist.py&quot;, line 985, in run_command   
          cmd_obj.run()
        File &quot;c:\users\aviparna.biswas\appdata\local\programs\python\python39\lib\site-packages\setuptools\command\install.py&quot;, line 61, in run
          return orig.install.run(self)
        File &quot;c:\users\aviparna.biswas\appdata\local\programs\python\python39\lib\distutils\command\install.py&quot;, line 546, in run
          self.run_command('build')
        File &quot;c:\users\aviparna.biswas\appdata\local\programs\python\python39\lib\distutils\cmd.py&quot;, line 313, in run_command    
          self.distribution.run_command(command)
        File &quot;c:\users\aviparna.biswas\appdata\local\programs\python\python39\lib\distutils\dist.py&quot;, line 985, in run_command   
          cmd_obj.run()
        File &quot;c:\users\aviparna.biswas\appdata\local\programs\python\python39\lib\distutils\command\build.py&quot;, line 135, in run  
          self.run_command(cmd_name)
        File &quot;c:\users\aviparna.biswas\appdata\local\programs\python\python39\lib\distutils\cmd.py&quot;, line 313, in run_command    
          self.distribution.run_command(command)
        File &quot;c:\users\aviparna.biswas\appdata\local\programs\python\python39\lib\distutils\dist.py&quot;, line 985, in run_command   
          cmd_obj.run()
        File &quot;C:\Users\aviparna.biswas\AppData\Local\Temp\pip-install-1u1dh1_j\dlib_0e99482dc2db4cb5a05e1507ea95d200\setup.py&quot;, line 134, in run
          self.build_extension(ext)
        File &quot;C:\Users\aviparna.biswas\AppData\Local\Temp\pip-install-1u1dh1_j\dlib_0e99482dc2db4cb5a05e1507ea95d200\setup.py&quot;, line 171, in build_extension
          subprocess.check_call(cmake_setup, cwd=build_folder)
        File &quot;c:\users\aviparna.biswas\appdata\local\programs\python\python39\lib\subprocess.py&quot;, line 373, in check_call        
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\aviparna.biswas\\AppData\\Local\\Temp\\pip-install-1u1dh1_j\\dlib_0e99482dc2db4cb5a05e1507ea95d200\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\aviparna.biswas\\AppData\\Local\\Temp\\pip-install-1u1dh1_j\\dlib_0e99482dc2db4cb5a05e1507ea95d200\\build\\lib.win-amd64-3.9', '-DPYTHON_EXECUTABLE=c:\\users\\aviparna.biswas\\appdata\\local\\programs\\python\\python39\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\aviparna.biswas\\AppData\\Local\\Temp\\pip-install-1u1dh1_j\\dlib_0e99482dc2db4cb5a05e1507ea95d200\\build\\lib.win-amd64-3.9', '-A', 'x64']' returned non-zero exit status 1.
      ----------------------------------------
  ERROR: Command errored out with exit status 1: 'c:\users\aviparna.biswas\appdata\local\programs\python\python39\python.exe' -u 
  -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '&quot;'&quot;'C:\\Users\\aviparna.biswas\\AppData\\Local\\Temp\\pip-install-1u1dh1_j\\dlib_0e99482dc2db4cb5a05e1507ea95d200\\setup.py'&quot;'&quot;'; __file__='&quot;'&quot;'C:\\Users\\aviparna.biswas\\AppData\\Local\\Temp\\pip-install-1u1dh1_j\\dlib_0e99482dc2db4cb5a05e1507ea95d200\\setup.py'&quot;'&quot;';f = getattr(tokenize, '&quot;'&quot;'open'&quot;'&quot;', open)(__file__) if os.path.exists(__file__) else io.StringIO('&quot;'&quot;'from setuptools import setup; setup()'&quot;'&quot;');code = f.read().replace('&quot;'&quot;'\r\n'&quot;'&quot;', '&quot;'&quot;'\n'&quot;'&quot;');f.close();exec(compile(code, __file__, '&quot;'&quot;'exec'&quot;'&quot;'))' install --record 'C:\Users\aviparna.biswas\AppData\Local\Temp\pip-record-prgz7cvz\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\aviparna.biswas\appdata\local\programs\python\python39\Include\dlib' Check the logs for full command output.```
  </code></pre>