Impossible d'installer 'face_recognition'

Bonjour,
je n’arrive pas a importer « face_recognition et dlib » message d’erreur :
"
PS D:\Python\projet python\reconnaissance faciale> pip install face-recognition
Collecting face-recognition
Using cached face_recognition-1.3.0-py2.py3-none-any.whl (15 kB)
Collecting dlib>=19.7
Using cached dlib-19.24.0.tar.gz (3.2 MB)
Preparing metadata (setup.py) … done
Requirement already satisfied: Pillow in c:\python\python310\lib\site-packages (from face-recognition) (9.2.0)
Requirement already satisfied: numpy in c:\python\python310\lib\site-packages (from face-recognition) (1.23.3)
Requirement already satisfied: Click>=6.0 in c:\python\python310\lib\site-packages (from face-recognition) (8.1.3)
Requirement already satisfied: face-recognition-models>=0.3.0 in c:\python\python310\lib\site-packages (from face-recognition) (0.3.0)
Requirement already satisfied: colorama in c:\python\python310\lib\site-packages (from Click>=6.0->face-recognition) (0.4.5)
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
╰─> [7 lines of output]
running bdist_wheel
running build
running build_py
running build_ext

  ERROR: CMake must be installed to build dlib

  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for dlib
Running setup.py clean for dlib
Failed to build dlib
Installing collected packages: dlib, face-recognition
Running setup.py install for dlib … error
error: subprocess-exited-with-error

× Running setup.py install for dlib did not run successfully.
│ exit code: 1
╰─> [9 lines of output]
running install
C:\Python\Python310\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
running build_ext

  ERROR: CMake must be installed to build dlib

  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> dlib

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
PS D:\Python\projet python\reconnaissance faciale>
"
je ne comprend rien
merci pour la réponse
cordialement
kyrob

Essayer d’abord d’installer CMake => pip install cmake , puis installer dlib => pip install dlib

Téléchargez et installez dlib wheel depuis ici

Puis pip install face_recognition

  • pip install cmake
  • Dans Visual Studio, onglet Composants individuels, case à cocher Outils Visual C++ pour Cmake dans la section Compilateurs, outils de construction et runtimes.
  • À l’invite de commande de Visual Studio, exécutez pip install face_recognition.

Il exige que cmake soit installé avant d’installer dlib. Faites l’exécution dans l’ordre suivant.

pip install cmake
pip install dlib

Cela corrigera le problème.

Bonjour jacques,
je n’ai pas réussi message :
"
PS D:\Python\projet python\reconnaissance faciale> pip install cmake
Requirement already satisfied: cmake in c:\python\python310\lib\site-packages (3.24.1.1)
PS D:\Python\projet python\reconnaissance faciale>
"
c’a a l’aire de fonctionne pour l’instant
"
PS D:\Python\projet python\reconnaissance faciale> pip install dlib
Collecting dlib
Using cached dlib-19.24.0.tar.gz (3.2 MB)
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
╰─> [70 lines of output]
running bdist_wheel
running build
running build_py
running build_ext
C:\Users\jacky\AppData\Local\Temp\pip-install-5crdc6rf\dlib_2173814c4c2d42c6812da69dacad0c85\setup.py:129: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
if LooseVersion(cmake_version) < ‹ 3.1.0 ›:
Building extension for Python 3.10.7 (tags/v3.10.7:6cc6b13, Sep 5 2022, 14:08:36) [MSC v.1933 64 bit (AMD64)]
Invoking CMake setup: ‹ cmake C:\Users\jacky\AppData\Local\Temp\pip-install-5crdc6rf\dlib_2173814c4c2d42c6812da69dacad0c85\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\jacky\AppData\Local\Temp\pip-install-5crdc6rf\dlib_2173814c4c2d42c6812da69dacad0c85\build\lib.win-amd64-cpython-310 -DPYTHON_EXECUTABLE=C:\Python\Python310\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\jacky\AppData\Local\Temp\pip-install-5crdc6rf\dlib_2173814c4c2d42c6812da69dacad0c85\build\lib.win-amd64-cpython-310 -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 "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "C:\Users\jacky\AppData\Local\Temp\pip-install-5crdc6rf\dlib_2173814c4c2d42c6812da69dacad0c85\setup.py", line 222, in <module>
      setup(
    File "C:\Python\Python310\lib\site-packages\setuptools\__init__.py", line 87, in setup
      return distutils.core.setup(**attrs)
    File "C:\Python\Python310\lib\site-packages\setuptools\_distutils\core.py", line 177, in setup
      return run_commands(dist)
    File "C:\Python\Python310\lib\site-packages\setuptools\_distutils\core.py", line 193, in run_commands
      dist.run_commands()
    File "C:\Python\Python310\lib\site-packages\setuptools\_distutils\dist.py", line 968, in run_commands
      self.run_command(cmd)
    File "C:\Python\Python310\lib\site-packages\setuptools\dist.py", line 1217, in run_command
      super().run_command(command)
    File "C:\Python\Python310\lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
      cmd_obj.run()
    File "C:\Python\Python310\lib\site-packages\wheel\bdist_wheel.py", line 299, in run
      self.run_command('build')
    File "C:\Python\Python310\lib\site-packages\setuptools\_distutils\cmd.py", line 317, in run_command
      self.distribution.run_command(command)
    File "C:\Python\Python310\lib\site-packages\setuptools\dist.py", line 1217, in run_command
      super().run_command(command)
    File "C:\Python\Python310\lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
      cmd_obj.run()
    File "C:\Python\Python310\lib\site-packages\setuptools\command\build.py", line 24, in run
      super().run()
    File "C:\Python\Python310\lib\site-packages\setuptools\_distutils\command\build.py", line 131, in run
      self.run_command(cmd_name)
    File "C:\Python\Python310\lib\site-packages\setuptools\_distutils\cmd.py", line 317, in run_command
      self.distribution.run_command(command)
    File "C:\Python\Python310\lib\site-packages\setuptools\dist.py", line 1217, in run_command
      super().run_command(command)
    File "C:\Python\Python310\lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
      cmd_obj.run()
    File "C:\Users\jacky\AppData\Local\Temp\pip-install-5crdc6rf\dlib_2173814c4c2d42c6812da69dacad0c85\setup.py", line 134, in run
      self.build_extension(ext)
    File "C:\Users\jacky\AppData\Local\Temp\pip-install-5crdc6rf\dlib_2173814c4c2d42c6812da69dacad0c85\setup.py", line 171, in build_extension
      subprocess.check_call(cmake_setup, cwd=build_folder)
    File "C:\Python\Python310\lib\subprocess.py", line 369, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\jacky\\AppData\\Local\\Temp\\pip-install-5crdc6rf\\dlib_2173814c4c2d42c6812da69dacad0c85\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\jacky\\AppData\\Local\\Temp\\pip-install-5crdc6rf\\dlib_2173814c4c2d42c6812da69dacad0c85\\build\\lib.win-amd64-cpython-310', '-DPYTHON_EXECUTABLE=C:\\Python\\Python310\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\jacky\\AppData\\Local\\Temp\\pip-install-5crdc6rf\\dlib_2173814c4c2d42c6812da69dacad0c85\\build\\lib.win-amd64-cpython-310', '-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
Running setup.py clean for dlib
Failed to build dlib
Installing collected packages: dlib
Running setup.py install for dlib … error
error: subprocess-exited-with-error

× Running setup.py install for dlib did not run successfully.
│ exit code: 1
╰─> [74 lines of output]
running install
C:\Python\Python310\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
running build_ext
C:\Users\jacky\AppData\Local\Temp\pip-install-5crdc6rf\dlib_2173814c4c2d42c6812da69dacad0c85\setup.py:129: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
if LooseVersion(cmake_version) < ‹ 3.1.0 ›:
Building extension for Python 3.10.7 (tags/v3.10.7:6cc6b13, Sep 5 2022, 14:08:36) [MSC v.1933 64 bit (AMD64)]
Invoking CMake setup: ‹ cmake C:\Users\jacky\AppData\Local\Temp\pip-install-5crdc6rf\dlib_2173814c4c2d42c6812da69dacad0c85\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\jacky\AppData\Local\Temp\pip-install-5crdc6rf\dlib_2173814c4c2d42c6812da69dacad0c85\build\lib.win-amd64-cpython-310 -DPYTHON_EXECUTABLE=C:\Python\Python310\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\jacky\AppData\Local\Temp\pip-install-5crdc6rf\dlib_2173814c4c2d42c6812da69dacad0c85\build\lib.win-amd64-cpython-310 -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 "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "C:\Users\jacky\AppData\Local\Temp\pip-install-5crdc6rf\dlib_2173814c4c2d42c6812da69dacad0c85\setup.py", line 222, in <module>
      setup(
    File "C:\Python\Python310\lib\site-packages\setuptools\__init__.py", line 87, in setup
      return distutils.core.setup(**attrs)
    File "C:\Python\Python310\lib\site-packages\setuptools\_distutils\core.py", line 177, in setup
      return run_commands(dist)
    File "C:\Python\Python310\lib\site-packages\setuptools\_distutils\core.py", line 193, in run_commands
      dist.run_commands()
    File "C:\Python\Python310\lib\site-packages\setuptools\_distutils\dist.py", line 968, in run_commands
      self.run_command(cmd)
    File "C:\Python\Python310\lib\site-packages\setuptools\dist.py", line 1217, in run_command
      super().run_command(command)
    File "C:\Python\Python310\lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
      cmd_obj.run()
    File "C:\Python\Python310\lib\site-packages\setuptools\command\install.py", line 68, in run
      return orig.install.run(self)
    File "C:\Python\Python310\lib\site-packages\setuptools\_distutils\command\install.py", line 695, in run
      self.run_command('build')
    File "C:\Python\Python310\lib\site-packages\setuptools\_distutils\cmd.py", line 317, in run_command
      self.distribution.run_command(command)
    File "C:\Python\Python310\lib\site-packages\setuptools\dist.py", line 1217, in run_command
      super().run_command(command)
    File "C:\Python\Python310\lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
      cmd_obj.run()
    File "C:\Python\Python310\lib\site-packages\setuptools\command\build.py", line 24, in run
      super().run()
    File "C:\Python\Python310\lib\site-packages\setuptools\_distutils\command\build.py", line 131, in run
      self.run_command(cmd_name)
    File "C:\Python\Python310\lib\site-packages\setuptools\_distutils\cmd.py", line 317, in run_command
      self.distribution.run_command(command)
    File "C:\Python\Python310\lib\site-packages\setuptools\dist.py", line 1217, in run_command
      super().run_command(command)
    File "C:\Python\Python310\lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
      cmd_obj.run()
    File "C:\Users\jacky\AppData\Local\Temp\pip-install-5crdc6rf\dlib_2173814c4c2d42c6812da69dacad0c85\setup.py", line 134, in run
      self.build_extension(ext)
    File "C:\Users\jacky\AppData\Local\Temp\pip-install-5crdc6rf\dlib_2173814c4c2d42c6812da69dacad0c85\setup.py", line 171, in build_extension
      subprocess.check_call(cmake_setup, cwd=build_folder)
    File "C:\Python\Python310\lib\subprocess.py", line 369, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\jacky\\AppData\\Local\\Temp\\pip-install-5crdc6rf\\dlib_2173814c4c2d42c6812da69dacad0c85\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\jacky\\AppData\\Local\\Temp\\pip-install-5crdc6rf\\dlib_2173814c4c2d42c6812da69dacad0c85\\build\\lib.win-amd64-cpython-310', '-DPYTHON_EXECUTABLE=C:\\Python\\Python310\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\jacky\\AppData\\Local\\Temp\\pip-install-5crdc6rf\\dlib_2173814c4c2d42c6812da69dacad0c85\\build\\lib.win-amd64-cpython-310', '-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: legacy-install-failure

× Encountered error while trying to install package.
╰─> dlib

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
PS D:\Python\projet python\reconnaissance faciale>
"
la c’a fonctionne pas ???
j’ai toute les version recentes
cordialement
kyrob

Bonjour Henri,
je n’ai pas réussi a télécharger dlib wheel je n’ai pas trouvé, j’ai télécharger dlib-19.19.0-cp37-cp37m-win_amd64.whl je n’ai pas réussi a l’installé. j’ai été voir sur le site Git Hub, j’ai pas réussi a m’en sortir , je ne connait pas l’anglais (65 ans) malgré Google traduction.
cordialement
kyrob

Avez-vous essayé d’installer Visual Studio pour C++ ?

Bonjour jacques,
je viens d’installé : C/C++ for Visual Studio Code (version Microsoft v1.12.4) ca ne fonctionne pas mieux, même avec version ‹ préliminaire v1.13.2 ›.
version de Visual Studio Code 1.72.2
Windows 11
python 3.10.7
merci quand même
cordialement
kyrob