@igorloadgame

Почему не получается установить библиотеку dlib?

Хотел установить библиотеки: cmake, dlib, face-recognition, и у меня они при установке выдают ошибку:
(venv) C:\Users\igotg\PycharmProjects\pythonProject>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: Command errored out with exit status 1:
   command: 'C:\Users\igotg\PycharmProjects\pythonProject\venv\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\igotg\\AppData\\Local\\Temp\\pip-install-_f13hztz\\dlib_95024e1ac1cd4e
668178db4bed7fccf0\\setup.py'"'"'; __file__='"'"'C:\\Users\\igotg\\AppData\\Local\\Temp\\pip-install-_f13hztz\\dlib_95024e1ac1cd4e668178db4bed7fccf0\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exi
sts(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\igotg\AppData\Local\Temp\pip-wheel-1c482bbx'
       cwd: C:\Users\igotg\AppData\Local\Temp\pip-install-_f13hztz\dlib_95024e1ac1cd4e668178db4bed7fccf0\
  Complete output (62 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
  C:\Users\igotg\AppData\Local\Temp\pip-install-_f13hztz\dlib_95024e1ac1cd4e668178db4bed7fccf0\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.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)]
  Invoking CMake setup: 'cmake C:\Users\igotg\AppData\Local\Temp\pip-install-_f13hztz\dlib_95024e1ac1cd4e668178db4bed7fccf0\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\igotg\AppData\Local\Temp\pip-install-_f13hztz\dlib_95
024e1ac1cd4e668178db4bed7fccf0\build\lib.win-amd64-3.8 -DPYTHON_EXECUTABLE=C:\Users\igotg\PycharmProjects\pythonProject\venv\Scripts\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\igotg\AppData\Local\Temp\pip-install-_f13hztz\dlib_95024e1ac1cd4e668178db4bed7fccf0\build\lib.win-amd64-3.8 -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 1, in <module>
    File "C:\Users\igotg\AppData\Local\Temp\pip-install-_f13hztz\dlib_95024e1ac1cd4e668178db4bed7fccf0\setup.py", line 222, in <module>
      setup(
    File "C:\Users\igotg\PycharmProjects\pythonProject\venv\lib\site-packages\setuptools\__init__.py", line 155, in setup
      return distutils.core.setup(**attrs)
    File "C:\Users\igotg\PycharmProjects\pythonProject\venv\lib\site-packages\setuptools\_distutils\core.py", line 148, in setup
      return run_commands(dist)
    File "C:\Users\igotg\PycharmProjects\pythonProject\venv\lib\site-packages\setuptools\_distutils\core.py", line 163, in run_commands
      dist.run_commands()
    File "C:\Users\igotg\PycharmProjects\pythonProject\venv\lib\site-packages\setuptools\_distutils\dist.py", line 967, in run_commands
      self.run_command(cmd)
    File "C:\Users\igotg\PycharmProjects\pythonProject\venv\lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
      cmd_obj.run()
    File "C:\Users\igotg\PycharmProjects\pythonProject\venv\lib\site-packages\wheel\bdist_wheel.py", line 299, in run
      self.run_command('build')
    File "C:\Users\igotg\PycharmProjects\pythonProject\venv\lib\site-packages\setuptools\_distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "C:\Users\igotg\PycharmProjects\pythonProject\venv\lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
      cmd_obj.run()
    File "C:\Users\igotg\PycharmProjects\pythonProject\venv\lib\site-packages\setuptools\_distutils\command\build.py", line 135, in run
      self.run_command(cmd_name)
    File "C:\Users\igotg\PycharmProjects\pythonProject\venv\lib\site-packages\setuptools\_distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "C:\Users\igotg\PycharmProjects\pythonProject\venv\lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
      cmd_obj.run()
    File "C:\Users\igotg\AppData\Local\Temp\pip-install-_f13hztz\dlib_95024e1ac1cd4e668178db4bed7fccf0\setup.py", line 134, in run
      self.build_extension(ext)
    File "C:\Users\igotg\AppData\Local\Temp\pip-install-_f13hztz\dlib_95024e1ac1cd4e668178db4bed7fccf0\setup.py", line 171, in build_extension
      subprocess.check_call(cmake_setup, cwd=build_folder)
    File "C:\Users\igotg\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 364, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\igotg\\AppData\\Local\\Temp\\pip-install-_f13hztz\\dlib_95024e1ac1cd4e668178db4bed7fccf0\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\igotg\\AppData\\L
ocal\\Temp\\pip-install-_f13hztz\\dlib_95024e1ac1cd4e668178db4bed7fccf0\\build\\lib.win-amd64-3.8', '-DPYTHON_EXECUTABLE=C:\\Users\\igotg\\PycharmProjects\\pythonProject\\venv\\Scripts\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\igotg\\AppData\\Local\\Temp\\pip-install-_f13hztz\\dlib_95024e1ac1cd4e668178db4bed7fccf0\\build\\lib.win-amd64-3.8', '-A', 'x64']' returned non-zero exit status 1.
  ----------------------------------------
  ERROR: Failed building wheel for dlib

В чем может быть проблема? Уже пытался переустанавливать версии питона(сейчас 3.8.0)
+ меня установлен VS2022 с C++ пакетами
  • Вопрос задан
  • 1681 просмотр
Решения вопроса 1
phaggi
@phaggi
лужу, паяю, ЭВМы починяю
dlib максимум 3.6 Python поддерживает.
Думаю, правильно будет создать виртуальное окружение (например virtualenv), pycharm это делает особенно удобно; и в нем поставить нужную версию python и остальные нужные библиотеки ставить там же. И там же писать код.

Также со слов Евгений Шатунов надо убедиться, что
должна стоять нагрузка на разработку C++ приложений с использованием cmake.
- как я понял, как раз об этом писали в большом транспаранте в traceback.
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы