Pip install dlib cmake error

dlib fails to install on Windows 10 #2371 Comments Expected Behavior Expected dlib to be instalable on Windows 10 running Python 3.6 (as a conda virtual env) with command: pip install dlib . Have installed cmake and numpy as prerequisites. This failed with: (py36) PS C:UsersJean Claude> pip install dlib Collecting dlib Using cached […]

Содержание

  1. dlib fails to install on Windows 10 #2371
  2. Comments
  3. Expected Behavior
  4. — Configuring incomplete, errors occurred! Traceback (most recent call last): File «», line 1, in File «C:UsersJEANCL 1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py», line 261, in ‘Topic :: Software Development’, File «C:UsersJean Claudeanaconda3envspy36libsite-packagessetuptools_init_.py», line 153, in setup return distutils.core.setup(**attrs) File «C:UsersJean Claudeanaconda3envspy36libdistutilscore.py», line 148, in setup dist.run_commands() File «C:UsersJean Claudeanaconda3envspy36libdistutilsdist.py», line 955, in run_commands self.run_command(cmd) File «C:UsersJean Claudeanaconda3envspy36libdistutilsdist.py», line 974, in run_command cmd_obj.run() File «C:UsersJean Claudeanaconda3envspy36libsite-packageswheelbdist_wheel.py», line 299, in run self.run_command(‘build’) File «C:UsersJean Claudeanaconda3envspy36libdistutilscmd.py», line 313, in run_command self.distribution.run_command(command) File «C:UsersJean Claudeanaconda3envspy36libdistutilsdist.py», line 974, in run_command cmd_obj.run() File «C:UsersJean Claudeanaconda3envspy36libdistutilscommandbuild.py», line 135, in run self.run_command(cmd_name) File «C:UsersJean Claudeanaconda3envspy36libdistutilscmd.py», line 313, in run_command self.distribution.run_command(command) File «C:UsersJean Claudeanaconda3envspy36libdistutilsdist.py», line 974, in run_command cmd_obj.run() File «C:UsersJEANCL 1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py», line 134, in run self.build_extension(ext) File «C:UsersJEANCL 1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py», line 171, in build_extension subprocess.check_call(cmake_setup, cwd=build_folder) File «C:UsersJean Claudeanaconda3envspy36libsubprocess.py», line 311, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command ‘[‘cmake’, ‘C:UsersJEANCL 1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242btoolspython’, ‘-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:UsersJEANCL 1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bbuildlib.win-amd64-3.6’, ‘-DPYTHON_EXECUTABLE=C:UsersJean Claudeanaconda3envspy36python.exe’, ‘-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:UsersJEANCL 1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bbuildlib.win-amd64-3.6’, ‘-A’, ‘x64′]’ returned non-zero exit status 1.
  5. cmake missing from setup #2307
  6. Comments
  7. Expected Behavior
  8. Current Behavior
  9. Steps to Reproduce
  10. Workaround
  11. Suggested fix
  12. Почему не получается установить библиотеку dlib?
  13. python2.7 pip install dlib error #1337
  14. Comments

dlib fails to install on Windows 10 #2371

Expected Behavior

Expected dlib to be instalable on Windows 10 running Python 3.6 (as a conda virtual env) with command: pip install dlib . Have installed cmake and numpy as prerequisites. This failed with:

(py36) PS C:UsersJean Claude> pip install dlib
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:UsersJean Claudeanaconda3envspy36python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘»‘»‘C:UsersJEANCL 1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py’»‘»‘; file=’»‘»‘C:UsersJEANCL 1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py’»‘»‘;f=getattr(tokenize, ‘»‘»‘open’»‘»‘, open)(file);code=f.read().replace(‘»‘»‘rn’»‘»‘, ‘»‘»‘n’»‘»‘);f.close();exec(compile(code, file, ‘»‘»‘exec’»‘»‘))’ bdist_wheel -d ‘C:UsersJEANCL 1AppDataLocalTemppip-wheel-03d14jpb’
cwd: C:UsersJEANCL 1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242b
Complete output (58 lines):
running bdist_wheel
running build
running build_py
package init file ‘toolspythondlib_init_.py’ not found (or not a regular file)
running build_ext
Building extension for Python 3.6.13 |Anaconda, Inc.| (default, Mar 16 2021, 11:37:27) [MSC v.1916 64 bit (AMD64)]
Invoking CMake setup: ‘cmake C:UsersJEANCL 1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242btoolspython -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:UsersJEANCL 1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bbuildlib.win-amd64-3.6 -DPYTHON_EXECUTABLE=C:UsersJean Claudeanaconda3envspy36python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:UsersJEANCL

1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bbuildlib.win-amd64-3.6 -A x64′
— Building for: NMake Makefiles
CMake Error at CMakeLists.txt:5 (message):

— Configuring incomplete, errors occurred!
Traceback (most recent call last):
File «», line 1, in
File «C:UsersJEANCL 1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py», line 261, in
‘Topic :: Software Development’,
File «C:UsersJean Claudeanaconda3envspy36libsite-packagessetuptools_init_.py», line 153, in setup
return distutils.core.setup(**attrs)
File «C:UsersJean Claudeanaconda3envspy36libdistutilscore.py», line 148, in setup
dist.run_commands()
File «C:UsersJean Claudeanaconda3envspy36libdistutilsdist.py», line 955, in run_commands
self.run_command(cmd)
File «C:UsersJean Claudeanaconda3envspy36libdistutilsdist.py», line 974, in run_command
cmd_obj.run()
File «C:UsersJean Claudeanaconda3envspy36libsite-packageswheelbdist_wheel.py», line 299, in run
self.run_command(‘build’)
File «C:UsersJean Claudeanaconda3envspy36libdistutilscmd.py», line 313, in run_command
self.distribution.run_command(command)
File «C:UsersJean Claudeanaconda3envspy36libdistutilsdist.py», line 974, in run_command
cmd_obj.run()
File «C:UsersJean Claudeanaconda3envspy36libdistutilscommandbuild.py», line 135, in run
self.run_command(cmd_name)
File «C:UsersJean Claudeanaconda3envspy36libdistutilscmd.py», line 313, in run_command
self.distribution.run_command(command)
File «C:UsersJean Claudeanaconda3envspy36libdistutilsdist.py», line 974, in run_command
cmd_obj.run()
File «C:UsersJEANCL 1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py», line 134, in run
self.build_extension(ext)
File «C:UsersJEANCL 1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py», line 171, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File «C:UsersJean Claudeanaconda3envspy36libsubprocess.py», line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘cmake’, ‘C:UsersJEANCL 1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242btoolspython’, ‘-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:UsersJEANCL 1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bbuildlib.win-amd64-3.6’, ‘-DPYTHON_EXECUTABLE=C:UsersJean Claudeanaconda3envspy36python.exe’, ‘-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:UsersJEANCL 1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bbuildlib.win-amd64-3.6’, ‘-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:UsersJean Claudeanaconda3envspy36python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘»‘»‘C:UsersJEANCL 1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py’»‘»‘; file=’»‘»‘C:UsersJEANCL 1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py’»‘»‘;f=getattr(tokenize, ‘»‘»‘open’»‘»‘, open)(file);code=f.read().replace(‘»‘»‘rn’»‘»‘, ‘»‘»‘n’»‘»‘);f.close();exec(compile(code, file, ‘»‘»‘exec’»‘»‘))’ install —record ‘C:UsersJEANCL 1AppDataLocalTemppip-record-odoruwutinstall-record.txt’ —single-version-externally-managed —compile —install-headers ‘C:UsersJean Claudeanaconda3envspy36Includedlib’
cwd: C:UsersJEANCL 1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242b
Complete output (60 lines):
running install
running build
running build_py
package init file ‘toolspythondlib_init_.py’ not found (or not a regular file)
running build_ext
Building extension for Python 3.6.13 |Anaconda, Inc.| (default, Mar 16 2021, 11:37:27) [MSC v.1916 64 bit (AMD64)]
Invoking CMake setup: ‘cmake C:UsersJEANCL 1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242btoolspython -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:UsersJEANCL 1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bbuildlib.win-amd64-3.6 -DPYTHON_EXECUTABLE=C:UsersJean Claudeanaconda3envspy36python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:UsersJEANCL

1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bbuildlib.win-amd64-3.6 -A x64′
— Building for: NMake Makefiles
CMake Error at CMakeLists.txt:5 (message):

1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py», line 261, in ‘Topic :: Software Development’, File «C:UsersJean Claudeanaconda3envspy36libsite-packagessetuptools__init__.py», line 153, in setup return distutils.core.setup(**attrs) File «C:UsersJean Claudeanaconda3envspy36libdistutilscore.py», line 148, in setup dist.run_commands() File «C:UsersJean Claudeanaconda3envspy36libdistutilsdist.py», line 955, in run_commands self.run_command(cmd) File «C:UsersJean Claudeanaconda3envspy36libdistutilsdist.py», line 974, in run_command cmd_obj.run() File «C:UsersJean Claudeanaconda3envspy36libsite-packagessetuptoolscommandinstall.py», line 61, in run return orig.install.run(self) File «C:UsersJean Claudeanaconda3envspy36libdistutilscommandinstall.py», line 545, in run self.run_command(‘build’) File «C:UsersJean Claudeanaconda3envspy36libdistutilscmd.py», line 313, in run_command self.distribution.run_command(command) File «C:UsersJean Claudeanaconda3envspy36libdistutilsdist.py», line 974, in run_command cmd_obj.run() File «C:UsersJean Claudeanaconda3envspy36libdistutilscommandbuild.py», line 135, in run self.run_command(cmd_name) File «C:UsersJean Claudeanaconda3envspy36libdistutilscmd.py», line 313, in run_command self.distribution.run_command(command) File «C:UsersJean Claudeanaconda3envspy36libdistutilsdist.py», line 974, in run_command cmd_obj.run() File «C:UsersJEANCL

1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py», line 134, in run self.build_extension(ext) File «C:UsersJEANCL

1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py», line 171, in build_extension subprocess.check_call(cmake_setup, cwd=build_folder) File «C:UsersJean Claudeanaconda3envspy36libsubprocess.py», line 311, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command ‘[‘cmake’, ‘C:\Users\JEANCL

1\AppData\Local\Temp\pip-install-bdv23ese\dlib_6034d75b85f2455eaa1e85e06b14242b\build\lib.win-amd64-3.6′, ‘-DPYTHON_EXECUTABLE=C:\Users\Jean Claude\anaconda3\envs\py36\python.exe’, ‘-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\JEANCL

1\AppData\Local\Temp\pip-install-bdv23ese\dlib_6034d75b85f2455eaa1e85e06b14242b\build\lib.win-amd64-3.6′, ‘-A’, ‘x64′]’ returned non-zero exit status 1. —————————————-«>

ERROR: Command errored out with exit status 1: ‘C:UsersJean Claudeanaconda3envspy36python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘»‘»‘C:UsersJEANCL 1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py’»‘»‘; file=’»‘»‘C:UsersJEANCL 1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py’»‘»‘;f=getattr(tokenize, ‘»‘»‘open’»‘»‘, open)(file);code=f.read().replace(‘»‘»‘rn’»‘»‘, ‘»‘»‘n’»‘»‘);f.close();exec(compile(code, file, ‘»‘»‘exec’»‘»‘))’ install —record ‘C:UsersJEANCL

1AppDataLocalTemppip-record-odoruwutinstall-record.txt’ —single-version-externally-managed —compile —install-headers ‘C:UsersJean Claudeanaconda3envspy36Includedlib’ Check the logs for full command output.

The text was updated successfully, but these errors were encountered:

Источник

cmake missing from setup #2307

Expected Behavior

pip install dlib

Current Behavior

RuntimeError:
*******************************************************************
CMake must be installed to build the following extensions: _dlib_pybind11

Steps to Reproduce

pip install dlib
Catalina 10.15.6

Workaround

pip install cmake
(before pip install dlib)

Suggested fix

Simply include cmake in setup

The text was updated successfully, but these errors were encountered:

dlib’s setup.py used to depend on cmake but two years ago it was removed because the version of cmake installed on some systems was aggressively broken. The result was that people would try to install dlib and pip would «install cmake», resulting in a broken cmake being installed, and IIRC hiding a good working cmake user already had. Resulting in things not working.

Maybe it’s better now. IDK. We can try turning it on again and seeing if the pip copy of cmake has its act together now. I just added the dependency to setup.py. You can try it and see if it works for you. Hopefully no one posts an issue where pip broke their cmake installs.

Ah yes, I hope I’m not the bad guy here. Finger’s crossed.

I may have been bitten by this issue in my build environment (or rather, the reverse, the issue that caused cmake to be removed in the first place).

I’m building a project depending on dlib , which I compile from source, by cloning this repo.

Prior to compiling dlib , I install cmake from ubuntu repos, which get me cmake v3.1.5. This succeeds in compiling dlib , and setuptools processes depdencencies without issue:

However, since this commit from a couple days ago, setuptools attempts to install cmake v3.18.4 when processing dependencies which doesn’t go so well:

If that can help, this error happened to me while compiling dlib on a docker instance running in AWS codebuild, using an image based off Ubuntu 16.04 and using python 3.5.

Источник

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

Хотел установить библиотеки: cmake, dlib, face-recognition, и у меня они при установке выдают ошибку:

В чем может быть проблема? Уже пытался переустанавливать версии питона(сейчас 3.8.0)
+ меня установлен VS2022 с C++ пакетами

  • Вопрос задан 27 окт. 2022
  • 164 просмотра

Простой 15 комментариев

You need to install Visual Studio for C++.

Я просмотрел важную штуку: Python 3.8, а glib максимум 3.6 поддерживает.

dlib максимум 3.6 Python поддерживает.
Думаю, правильно будет создать виртуальное окружение (например virtualenv), pycharm это делает особенно удобно; и в нем поставить нужную версию python и остальные нужные библиотеки ставить там же. И там же писать код.

Также со слов Евгений Шатунов надо убедиться, что

должна стоять нагрузка на разработку C++ приложений с использованием cmake.

dlib вроде вполне себе работает и под свежими версиями python. У меня вполне успешно устанавливается и все задачи выполняет:

Источник

python2.7 pip install dlib error #1337

Collecting dlib
Using cached https://files.pythonhosted.org/packages/79/26/8ef2835606b4b37f704862b2db55edb89675daca0b82718244fca718cddd/dlib-19.13.0.tar.gz
Building wheels for collected packages: dlib
Running setup.py bdist_wheel for dlib: started
Running setup.py bdist_wheel for dlib: finished with status ‘error’
Complete output from command /usr/bin/python -u -c «import setuptools, tokenize;file=’/tmp/pip-install-lIh_fo/dlib/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(‘rn’, ‘n’);f.close();exec(compile(code, file, ‘exec’))» bdist_wheel -d /tmp/pip-wheel-qnWYfi —python-tag cp27:
running bdist_wheel
running build
running build_py
package init file ‘dlib/init.py’ not found (or not a regular file)
running build_ext
Building extension for Python 2.7.12 (default, Dec 4 2017, 14:50:18)
Invoking CMake setup: ‘cmake /tmp/pip-install-lIh_fo/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-lIh_fo/dlib/build/lib.linux-aarch64-2.7 -DPYTHON_EXECUTABLE=/usr/bin/python -DCMAKE_BUILD_TYPE=Release’
— The C compiler identification is GNU 5.4.0
— The CXX compiler identification is GNU 5.4.0
— Check for working C compiler: /usr/bin/cc
— Check for working C compiler: /usr/bin/cc — works
— Detecting C compiler ABI info
— Detecting C compiler ABI info — done
— Detecting C compile features
— Detecting C compile features — done
— Check for working CXX compiler: /usr/bin/c++
— Check for working CXX compiler: /usr/bin/c++ — works
— Detecting CXX compiler ABI info
— Detecting CXX compiler ABI info — done
— Detecting CXX compile features
— Detecting CXX compile features — done
— Found PythonInterp: /usr/bin/python (found version «2.7.12»)
— Found PythonLibs: /usr/lib/aarch64-linux-gnu/libpython2.7.so
— Performing Test HAS_CPP14_FLAG
— Performing Test HAS_CPP14_FLAG — Success
— pybind11 v2.2.2
CMake Error at CMakeLists.txt:17 (if):
if given arguments:

CMake Error: Internal CMake error, TryCompile configure of cmake failed
— Configuring incomplete, errors occurred!
See also «/tmp/pip-install-lIh_fo/dlib/build/temp.linux-aarch64-2.7/CMakeFiles/CMakeOutput.log».
Traceback (most recent call last):
File «», line 1, in
File «/tmp/pip-install-lIh_fo/dlib/setup.py», line 256, in
‘Topic :: Software Development’,
File «/usr/lib/python2.7/distutils/core.py», line 151, in setup
dist.run_commands()
File «/usr/lib/python2.7/distutils/dist.py», line 953, in run_commands
self.run_command(cmd)
File «/usr/lib/python2.7/distutils/dist.py», line 972, in run_command
cmd_obj.run()
File «/usr/lib/python2.7/dist-packages/wheel/bdist_wheel.py», line 179, in run
self.run_command(‘build’)
File «/usr/lib/python2.7/distutils/cmd.py», line 326, in run_command
self.distribution.run_command(command)
File «/usr/lib/python2.7/distutils/dist.py», line 972, in run_command
cmd_obj.run()
File «/usr/lib/python2.7/distutils/command/build.py», line 128, in run
self.run_command(cmd_name)
File «/usr/lib/python2.7/distutils/cmd.py», line 326, in run_command
self.distribution.run_command(command)
File «/usr/lib/python2.7/distutils/dist.py», line 972, in run_command
cmd_obj.run()
File «/tmp/pip-install-lIh_fo/dlib/setup.py», line 133, in run
self.build_extension(ext)
File «/tmp/pip-install-lIh_fo/dlib/setup.py», line 169, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File «/usr/lib/python2.7/subprocess.py», line 541, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘cmake’, ‘/tmp/pip-install-lIh_fo/dlib/tools/python’, ‘-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-lIh_fo/dlib/build/lib.linux-aarch64-2.7’, ‘-DPYTHON_EXECUTABLE=/usr/bin/python’, ‘-DCMAKE_BUILD_TYPE=Release’]’ returned non-zero exit status 1

Running setup.py clean for dlib
Failed to build dlib
Installing collected packages: dlib
Running setup.py install for dlib: started
Running setup.py install for dlib: finished with status ‘error’
Complete output from command /usr/bin/python -u -c «import setuptools, tokenize;file=’/tmp/pip-install-lIh_fo/dlib/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(‘rn’, ‘n’);f.close();exec(compile(code, file, ‘exec’))» install —record /tmp/pip-record-sHrt4s/install-record.txt —single-version-externally-managed —compile:
running install
running build
running build_py
package init file ‘dlib/init.py’ not found (or not a regular file)
running build_ext
Building extension for Python 2.7.12 (default, Dec 4 2017, 14:50:18)
Invoking CMake setup: ‘cmake /tmp/pip-install-lIh_fo/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-lIh_fo/dlib/build/lib.linux-aarch64-2.7 -DPYTHON_EXECUTABLE=/usr/bin/python -DCMAKE_BUILD_TYPE=Release’
— The C compiler identification is GNU 5.4.0
— The CXX compiler identification is GNU 5.4.0
— Check for working C compiler: /usr/bin/cc
— Check for working C compiler: /usr/bin/cc — works
— Detecting C compiler ABI info
— Detecting C compiler ABI info — done
— Detecting C compile features
— Detecting C compile features — done
— Check for working CXX compiler: /usr/bin/c++
— Check for working CXX compiler: /usr/bin/c++ — works
— Detecting CXX compiler ABI info
— Detecting CXX compiler ABI info — done
— Detecting CXX compile features
— Detecting CXX compile features — done
— Found PythonInterp: /usr/bin/python (found version «2.7.12»)
— Found PythonLibs: /usr/lib/aarch64-linux-gnu/libpython2.7.so
— Performing Test HAS_CPP14_FLAG
— Performing Test HAS_CPP14_FLAG — Success
— pybind11 v2.2.2
CMake Error at CMakeLists.txt:17 (if):
if given arguments:

  • Version:19.13
  • Where did you get dlib: pip install dlib
  • Platform: ubuntu16.04 64-bit
  • Compiler: linaro 5.4 gcc

The text was updated successfully, but these errors were encountered:

Источник

Expected Behavior

Expected dlib to be instalable on Windows 10 running Python 3.6 (as a conda virtual env) with command: pip install dlib. Have installed cmake and numpy as prerequisites. This failed with:

(py36) PS C:UsersJean Claude> pip install dlib
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:UsersJean Claudeanaconda3envspy36python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘»‘»‘C:UsersJEANCL1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py'»‘»‘; file='»‘»‘C:UsersJEANCL1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py'»‘»‘;f=getattr(tokenize, ‘»‘»‘open'»‘»‘, open)(file);code=f.read().replace(‘»‘»‘rn'»‘»‘, ‘»‘»‘n'»‘»‘);f.close();exec(compile(code, file, ‘»‘»‘exec'»‘»‘))’ bdist_wheel -d ‘C:UsersJEANCL1AppDataLocalTemppip-wheel-03d14jpb’
cwd: C:UsersJEANCL1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242b
Complete output (58 lines):
running bdist_wheel
running build
running build_py
package init file ‘toolspythondlib_init_.py’ not found (or not a regular file)
running build_ext
Building extension for Python 3.6.13 |Anaconda, Inc.| (default, Mar 16 2021, 11:37:27) [MSC v.1916 64 bit (AMD64)]
Invoking CMake setup: ‘cmake C:UsersJEANCL1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242btoolspython -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:UsersJEANCL1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bbuildlib.win-amd64-3.6 -DPYTHON_EXECUTABLE=C:UsersJean Claudeanaconda3envspy36python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:UsersJEANCL~1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bbuildlib.win-amd64-3.6 -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 «», line 1, in
File «C:UsersJEANCL1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py», line 261, in
‘Topic :: Software Development’,
File «C:UsersJean Claudeanaconda3envspy36libsite-packagessetuptools_init_.py», line 153, in setup
return distutils.core.setup(**attrs)
File «C:UsersJean Claudeanaconda3envspy36libdistutilscore.py», line 148, in setup
dist.run_commands()
File «C:UsersJean Claudeanaconda3envspy36libdistutilsdist.py», line 955, in run_commands
self.run_command(cmd)
File «C:UsersJean Claudeanaconda3envspy36libdistutilsdist.py», line 974, in run_command
cmd_obj.run()
File «C:UsersJean Claudeanaconda3envspy36libsite-packageswheelbdist_wheel.py», line 299, in run
self.run_command(‘build’)
File «C:UsersJean Claudeanaconda3envspy36libdistutilscmd.py», line 313, in run_command
self.distribution.run_command(command)
File «C:UsersJean Claudeanaconda3envspy36libdistutilsdist.py», line 974, in run_command
cmd_obj.run()
File «C:UsersJean Claudeanaconda3envspy36libdistutilscommandbuild.py», line 135, in run
self.run_command(cmd_name)
File «C:UsersJean Claudeanaconda3envspy36libdistutilscmd.py», line 313, in run_command
self.distribution.run_command(command)
File «C:UsersJean Claudeanaconda3envspy36libdistutilsdist.py», line 974, in run_command
cmd_obj.run()
File «C:UsersJEANCL1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py», line 134, in run
self.build_extension(ext)
File «C:UsersJEANCL1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py», line 171, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File «C:UsersJean Claudeanaconda3envspy36libsubprocess.py», line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘cmake’, ‘C:UsersJEANCL1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242btoolspython’, ‘-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:UsersJEANCL1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bbuildlib.win-amd64-3.6’, ‘-DPYTHON_EXECUTABLE=C:UsersJean Claudeanaconda3envspy36python.exe’, ‘-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:UsersJEANCL1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bbuildlib.win-amd64-3.6’, ‘-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:UsersJean Claudeanaconda3envspy36python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘»‘»‘C:UsersJEANCL1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py'»‘»‘; file='»‘»‘C:UsersJEANCL1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py'»‘»‘;f=getattr(tokenize, ‘»‘»‘open'»‘»‘, open)(file);code=f.read().replace(‘»‘»‘rn'»‘»‘, ‘»‘»‘n'»‘»‘);f.close();exec(compile(code, file, ‘»‘»‘exec'»‘»‘))’ install —record ‘C:UsersJEANCL1AppDataLocalTemppip-record-odoruwutinstall-record.txt’ —single-version-externally-managed —compile —install-headers ‘C:UsersJean Claudeanaconda3envspy36Includedlib’
cwd: C:UsersJEANCL1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242b
Complete output (60 lines):
running install
running build
running build_py
package init file ‘toolspythondlib_init_.py’ not found (or not a regular file)
running build_ext
Building extension for Python 3.6.13 |Anaconda, Inc.| (default, Mar 16 2021, 11:37:27) [MSC v.1916 64 bit (AMD64)]
Invoking CMake setup: ‘cmake C:UsersJEANCL1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242btoolspython -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:UsersJEANCL1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bbuildlib.win-amd64-3.6 -DPYTHON_EXECUTABLE=C:UsersJean Claudeanaconda3envspy36python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:UsersJEANCL~1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bbuildlib.win-amd64-3.6 -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:UsersJEANCL~1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py", line 261, in <module>
    'Topic :: Software Development',
  File "C:UsersJean Claudeanaconda3envspy36libsite-packagessetuptools__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "C:UsersJean Claudeanaconda3envspy36libdistutilscore.py", line 148, in setup
    dist.run_commands()
  File "C:UsersJean Claudeanaconda3envspy36libdistutilsdist.py", line 955, in run_commands
    self.run_command(cmd)
  File "C:UsersJean Claudeanaconda3envspy36libdistutilsdist.py", line 974, in run_command
    cmd_obj.run()
  File "C:UsersJean Claudeanaconda3envspy36libsite-packagessetuptoolscommandinstall.py", line 61, in run
    return orig.install.run(self)
  File "C:UsersJean Claudeanaconda3envspy36libdistutilscommandinstall.py", line 545, in run
    self.run_command('build')
  File "C:UsersJean Claudeanaconda3envspy36libdistutilscmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:UsersJean Claudeanaconda3envspy36libdistutilsdist.py", line 974, in run_command
    cmd_obj.run()
  File "C:UsersJean Claudeanaconda3envspy36libdistutilscommandbuild.py", line 135, in run
    self.run_command(cmd_name)
  File "C:UsersJean Claudeanaconda3envspy36libdistutilscmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:UsersJean Claudeanaconda3envspy36libdistutilsdist.py", line 974, in run_command
    cmd_obj.run()
  File "C:UsersJEANCL~1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py", line 134, in run
    self.build_extension(ext)
  File "C:UsersJEANCL~1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py", line 171, in build_extension
    subprocess.check_call(cmake_setup, cwd=build_folder)
  File "C:UsersJean Claudeanaconda3envspy36libsubprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\Users\JEANCL~1\AppData\Local\Temp\pip-install-bdv23ese\dlib_6034d75b85f2455eaa1e85e06b14242b\tools\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\JEANCL~1\AppData\Local\Temp\pip-install-bdv23ese\dlib_6034d75b85f2455eaa1e85e06b14242b\build\lib.win-amd64-3.6', '-DPYTHON_EXECUTABLE=C:\Users\Jean Claude\anaconda3\envs\py36\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\JEANCL~1\AppData\Local\Temp\pip-install-bdv23ese\dlib_6034d75b85f2455eaa1e85e06b14242b\build\lib.win-amd64-3.6', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------

ERROR: Command errored out with exit status 1: ‘C:UsersJean Claudeanaconda3envspy36python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘»‘»‘C:UsersJEANCL1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py'»‘»‘; file='»‘»‘C:UsersJEANCL1AppDataLocalTemppip-install-bdv23esedlib_6034d75b85f2455eaa1e85e06b14242bsetup.py'»‘»‘;f=getattr(tokenize, ‘»‘»‘open'»‘»‘, open)(file);code=f.read().replace(‘»‘»‘rn'»‘»‘, ‘»‘»‘n'»‘»‘);f.close();exec(compile(code, file, ‘»‘»‘exec'»‘»‘))’ install —record ‘C:UsersJEANCL~1AppDataLocalTemppip-record-odoruwutinstall-record.txt’ —single-version-externally-managed —compile —install-headers ‘C:UsersJean Claudeanaconda3envspy36Includedlib’ Check the logs for full command output.

Хотел установить библиотеки: cmake, dlib, face-recognition, и у меня они при установке выдают ошибку:

(venv) C:UsersigotgPycharmProjectspythonProject>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:UsersigotgPycharmProjectspythonProjectvenvScriptspython.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('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:UsersigotgAppDataLocalTemppip-wheel-1c482bbx'
       cwd: C:UsersigotgAppDataLocalTemppip-install-_f13hztzdlib_95024e1ac1cd4e668178db4bed7fccf0
  Complete output (62 lines):
  running bdist_wheel
  running build
  running build_py
  package init file 'toolspythondlib__init__.py' not found (or not a regular file)
  running build_ext
  C:UsersigotgAppDataLocalTemppip-install-_f13hztzdlib_95024e1ac1cd4e668178db4bed7fccf0setup.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:UsersigotgAppDataLocalTemppip-install-_f13hztzdlib_95024e1ac1cd4e668178db4bed7fccf0toolspython -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:UsersigotgAppDataLocalTemppip-install-_f13hztzdlib_95
024e1ac1cd4e668178db4bed7fccf0buildlib.win-amd64-3.8 -DPYTHON_EXECUTABLE=C:UsersigotgPycharmProjectspythonProjectvenvScriptspython.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:UsersigotgAppDataLocalTemppip-install-_f13hztzdlib_95024e1ac1cd4e668178db4bed7fccf0buildlib.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:UsersigotgAppDataLocalTemppip-install-_f13hztzdlib_95024e1ac1cd4e668178db4bed7fccf0setup.py", line 222, in <module>
      setup(
    File "C:UsersigotgPycharmProjectspythonProjectvenvlibsite-packagessetuptools__init__.py", line 155, in setup
      return distutils.core.setup(**attrs)
    File "C:UsersigotgPycharmProjectspythonProjectvenvlibsite-packagessetuptools_distutilscore.py", line 148, in setup
      return run_commands(dist)
    File "C:UsersigotgPycharmProjectspythonProjectvenvlibsite-packagessetuptools_distutilscore.py", line 163, in run_commands
      dist.run_commands()
    File "C:UsersigotgPycharmProjectspythonProjectvenvlibsite-packagessetuptools_distutilsdist.py", line 967, in run_commands
      self.run_command(cmd)
    File "C:UsersigotgPycharmProjectspythonProjectvenvlibsite-packagessetuptools_distutilsdist.py", line 986, in run_command
      cmd_obj.run()
    File "C:UsersigotgPycharmProjectspythonProjectvenvlibsite-packageswheelbdist_wheel.py", line 299, in run
      self.run_command('build')
    File "C:UsersigotgPycharmProjectspythonProjectvenvlibsite-packagessetuptools_distutilscmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "C:UsersigotgPycharmProjectspythonProjectvenvlibsite-packagessetuptools_distutilsdist.py", line 986, in run_command
      cmd_obj.run()
    File "C:UsersigotgPycharmProjectspythonProjectvenvlibsite-packagessetuptools_distutilscommandbuild.py", line 135, in run
      self.run_command(cmd_name)
    File "C:UsersigotgPycharmProjectspythonProjectvenvlibsite-packagessetuptools_distutilscmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "C:UsersigotgPycharmProjectspythonProjectvenvlibsite-packagessetuptools_distutilsdist.py", line 986, in run_command
      cmd_obj.run()
    File "C:UsersigotgAppDataLocalTemppip-install-_f13hztzdlib_95024e1ac1cd4e668178db4bed7fccf0setup.py", line 134, in run
      self.build_extension(ext)
    File "C:UsersigotgAppDataLocalTemppip-install-_f13hztzdlib_95024e1ac1cd4e668178db4bed7fccf0setup.py", line 171, in build_extension
      subprocess.check_call(cmake_setup, cwd=build_folder)
    File "C:UsersigotgAppDataLocalProgramsPythonPython38libsubprocess.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++ пакетами

Issue

Im trying to installing dlib on python 3.7 but it always failed

I’ve installed the cmake and add it to my environment, i’ve upgraded my pip into the latest version,
but everytime i run

pip install dlib

It returns error as

Collecting dlib
  Using cached dlib-19.19.0.tar.gz (3.2 MB)
Installing collected packages: dlib
    Running setup.py install for dlib ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:userscharlesappdatalocalprogramspythonpython37python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Charles\AppData\Local\Temp\pip-install-6wd_c0pw\dlib\setup.py'"'"'; __file__='"'"'C:\Users\Charles\AppData\Local\Temp\pip-install-6wd_c0pw\dlib\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersCharlesAppDataLocalTemppip-record-xchasbrxinstall-record.txt' --single-version-externally-managed --compile --install-headers 'c:userscharlesappdatalocalprogramspythonpython37Includedlib'
         cwd: C:UsersCharlesAppDataLocalTemppip-install-6wd_c0pwdlib
    Complete output (74 lines):
    running install
    running build
    running build_py
    package init file 'dlib__init__.py' not found (or not a regular file)
    running build_ext
    Building extension for Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)]
    Invoking CMake setup: 'cmake C:UsersCharlesAppDataLocalTemppip-install-6wd_c0pwdlibtoolspython -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:UsersCharlesAppDataLocalTemppip-install-6wd_c0pwdlibbuildlib.win-amd64-3.7 -DPYTHON_EXECUTABLE=c:userscharlesappdatalocalprogramspythonpython37python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:UsersCharlesAppDataLocalTemppip-install-6wd_c0pwdlibbuildlib.win-amd64-3.7 -A x64'
    -- Building for: Visual Studio 10 2010
    CMake Error at CMakeLists.txt:3 (project):
      Failed to run MSBuild command:

        C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe

      to get the value of VCTargetsPath:

        Microsoft (R) Build Engine version 4.8.3752.0
        [Microsoft .NET Framework, version 4.0.30319.42000]
        Copyright (C) Microsoft Corporation. All rights reserved.

        Build started 2/7/2020 12:37:32 PM.
        Project "C:UsersCharlesAppDataLocalTemppip-install-6wd_c0pwdlibbuildtemp.win-amd64-3.7ReleaseCMakeFiles3.16.3VCTargetsPath.vcxproj" on node 1 (default targets).
        C:UsersCharlesAppDataLocalTemppip-install-6wd_c0pwdlibbuildtemp.win-amd64-3.7ReleaseCMakeFiles3.16.3VCTargetsPath.vcxproj(14,2): error MSB4019: The imported project "C:Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
        Done Building Project "C:UsersCharlesAppDataLocalTemppip-install-6wd_c0pwdlibbuildtemp.win-amd64-3.7ReleaseCMakeFiles3.16.3VCTargetsPath.vcxproj" (default targets) -- FAILED.

        Build FAILED.

        "C:UsersCharlesAppDataLocalTemppip-install-6wd_c0pwdlibbuildtemp.win-amd64-3.7ReleaseCMakeFiles3.16.3VCTargetsPath.vcxproj" (default target) (1) ->
          C:UsersCharlesAppDataLocalTemppip-install-6wd_c0pwdlibbuildtemp.win-amd64-3.7ReleaseCMakeFiles3.16.3VCTargetsPath.vcxproj(14,2): error MSB4019: The imported project "C:Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

            0 Warning(s)
            1 Error(s)

        Time Elapsed 00:00:00.01


      Exit code: 1



    -- Configuring incomplete, errors occurred!
    See also "C:/Users/Charles/AppData/Local/Temp/pip-install-6wd_c0pw/dlib/build/temp.win-amd64-3.7/Release/CMakeFiles/CMakeOutput.log".
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:UsersCharlesAppDataLocalTemppip-install-6wd_c0pwdlibsetup.py", line 261, in <module>
        'Topic :: Software Development',
      File "c:userscharlesappdatalocalprogramspythonpython37libsite-packagessetuptools__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "c:userscharlesappdatalocalprogramspythonpython37libdistutilscore.py", line 148, in setup
        dist.run_commands()
      File "c:userscharlesappdatalocalprogramspythonpython37libdistutilsdist.py", line 966, in run_commands
        self.run_command(cmd)
      File "c:userscharlesappdatalocalprogramspythonpython37libdistutilsdist.py", line 985, in run_command
        cmd_obj.run()
      File "c:userscharlesappdatalocalprogramspythonpython37libsite-packagessetuptoolscommandinstall.py", line 61, in run
        return orig.install.run(self)
      File "c:userscharlesappdatalocalprogramspythonpython37libdistutilscommandinstall.py", line 545, in run
        self.run_command('build')
      File "c:userscharlesappdatalocalprogramspythonpython37libdistutilscmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "c:userscharlesappdatalocalprogramspythonpython37libdistutilsdist.py", line 985, in run_command
        cmd_obj.run()
      File "c:userscharlesappdatalocalprogramspythonpython37libdistutilscommandbuild.py", line 135, in run
        self.run_command(cmd_name)
      File "c:userscharlesappdatalocalprogramspythonpython37libdistutilscmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "c:userscharlesappdatalocalprogramspythonpython37libdistutilsdist.py", line 985, in run_command
        cmd_obj.run()
      File "C:UsersCharlesAppDataLocalTemppip-install-6wd_c0pwdlibsetup.py", line 135, in run
        self.build_extension(ext)
      File "C:UsersCharlesAppDataLocalTemppip-install-6wd_c0pwdlibsetup.py", line 172, in build_extension
        subprocess.check_call(cmake_setup, cwd=build_folder)
      File "c:userscharlesappdatalocalprogramspythonpython37libsubprocess.py", line 347, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', 'C:\Users\Charles\AppData\Local\Temp\pip-install-6wd_c0pw\dlib\tools\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Charles\AppData\Local\Temp\pip-install-6wd_c0pw\dlib\build\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=c:\users\charles\appdata\local\programs\python\python37\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Charles\AppData\Local\Temp\pip-install-6wd_c0pw\dlib\build\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:userscharlesappdatalocalprogramspythonpython37python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Charles\AppData\Local\Temp\pip-install-6wd_c0pw\dlib\setup.py'"'"'; __file__='"'"'C:\Users\Charles\AppData\Local\Temp\pip-install-6wd_c0pw\dlib\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersCharlesAppDataLocalTemppip-record-xchasbrxinstall-record.txt' --single-version-externally-managed --compile --install-headers 'c:userscharlesappdatalocalprogramspythonpython37Includedlib' Check the logs for full command output.

i also installed it by:

  1. go here https://pypi.org/simple/dlib/
  2. pick dlib-19.18.0.tar.gz
  3. extract it, and go into the folder
  4. open command line then run python setup.py install

it returns:

running install
running bdist_egg
running egg_info
writing dlib.egg-infoPKG-INFO
writing dependency_links to dlib.egg-infodependency_links.txt
writing top-level names to dlib.egg-infotop_level.txt
package init file 'dlib__init__.py' not found (or not a regular file)
reading manifest file 'dlib.egg-infoSOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'toolspythonbuild*'
no previously-included directories found matching 'dlibtest'
writing manifest file 'dlib.egg-infoSOURCES.txt'
installing library code to buildbdist.win-amd64egg
running install_lib
running build_py
running build_ext
Building extension for Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:UsersCharlesDownloadsdlib-19.18.0.tardistdlib-19.18.0toolspython -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:UsersCharlesDownloadsdlib-19.18.0.tardistdlib-19.18.0buildlib.win-amd64-3.7 -DPYTHON_EXECUTABLE=C:UsersCharlesAppDataLocalProgramsPythonPython37python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:UsersCharlesDownloadsdlib-19.18.0.tardistdlib-19.18.0buildlib.win-amd64-3.7 -A x64'
CMake Error at CMakeLists.txt:3 (project):
  Failed to run MSBuild command:

    C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe

  to get the value of VCTargetsPath:

    Microsoft (R) Build Engine version 4.8.3752.0
    [Microsoft .NET Framework, version 4.0.30319.42000]
    Copyright (C) Microsoft Corporation. All rights reserved.

    Build started 2/7/2020 12:21:15 PM.
    Project "C:UsersCharlesDownloadsdlib-19.18.0.tardistdlib-19.18.0buildtemp.win-amd64-3.7ReleaseCMakeFiles3.16.3VCTargetsPath.vcxproj" on node 1 (default targets).
    C:UsersCharlesDownloadsdlib-19.18.0.tardistdlib-19.18.0buildtemp.win-amd64-3.7ReleaseCMakeFiles3.16.3VCTargetsPath.vcxproj(14,2): error MSB4019: The imported project "C:Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
    Done Building Project "C:UsersCharlesDownloadsdlib-19.18.0.tardistdlib-19.18.0buildtemp.win-amd64-3.7ReleaseCMakeFiles3.16.3VCTargetsPath.vcxproj" (default targets) -- FAILED.

    Build FAILED.

    "C:UsersCharlesDownloadsdlib-19.18.0.tardistdlib-19.18.0buildtemp.win-amd64-3.7ReleaseCMakeFiles3.16.3VCTargetsPath.vcxproj" (default target) (1) ->
      C:UsersCharlesDownloadsdlib-19.18.0.tardistdlib-19.18.0buildtemp.win-amd64-3.7ReleaseCMakeFiles3.16.3VCTargetsPath.vcxproj(14,2): error MSB4019: The imported project "C:Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

        0 Warning(s)
        1 Error(s)

    Time Elapsed 00:00:00.06


  Exit code: 1



-- Configuring incomplete, errors occurred!
See also "C:/Users/Charles/Downloads/dlib-19.18.0.tar/dist/dlib-19.18.0/build/temp.win-amd64-3.7/Release/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
  File "setup.py", line 261, in <module>
    'Topic :: Software Development',
  File "C:UsersCharlesAppDataLocalProgramsPythonPython37libsite-packagessetuptools__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "C:UsersCharlesAppDataLocalProgramsPythonPython37libdistutilscore.py", line 148, in setup
    dist.run_commands()
  File "C:UsersCharlesAppDataLocalProgramsPythonPython37libdistutilsdist.py", line 966, in run_commands
    self.run_command(cmd)
  File "C:UsersCharlesAppDataLocalProgramsPythonPython37libdistutilsdist.py", line 985, in run_command
    cmd_obj.run()
  File "C:UsersCharlesAppDataLocalProgramsPythonPython37libsite-packagessetuptoolscommandinstall.py", line 67, in run
    self.do_egg_install()
  File "C:UsersCharlesAppDataLocalProgramsPythonPython37libsite-packagessetuptoolscommandinstall.py", line 109, in do_egg_install
    self.run_command('bdist_egg')
  File "C:UsersCharlesAppDataLocalProgramsPythonPython37libdistutilscmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:UsersCharlesAppDataLocalProgramsPythonPython37libdistutilsdist.py", line 985, in run_command
    cmd_obj.run()
  File "C:UsersCharlesAppDataLocalProgramsPythonPython37libsite-packagessetuptoolscommandbdist_egg.py", line 172, in run
    cmd = self.call_command('install_lib', warn_dir=0)
  File "C:UsersCharlesAppDataLocalProgramsPythonPython37libsite-packagessetuptoolscommandbdist_egg.py", line 158, in call_command
    self.run_command(cmdname)
  File "C:UsersCharlesAppDataLocalProgramsPythonPython37libdistutilscmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:UsersCharlesAppDataLocalProgramsPythonPython37libdistutilsdist.py", line 985, in run_command
    cmd_obj.run()
  File "C:UsersCharlesAppDataLocalProgramsPythonPython37libsite-packagessetuptoolscommandinstall_lib.py", line 11, in run
    self.build()
  File "C:UsersCharlesAppDataLocalProgramsPythonPython37libdistutilscommandinstall_lib.py", line 107, in build
    self.run_command('build_ext')
  File "C:UsersCharlesAppDataLocalProgramsPythonPython37libdistutilscmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:UsersCharlesAppDataLocalProgramsPythonPython37libdistutilsdist.py", line 985, in run_command
    cmd_obj.run()
  File "setup.py", line 135, in run
    self.build_extension(ext)
  File "setup.py", line 172, in build_extension
    subprocess.check_call(cmake_setup, cwd=build_folder)
  File "C:UsersCharlesAppDataLocalProgramsPythonPython37libsubprocess.py", line 347, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\Users\Charles\Downloads\dlib-19.18.0.tar\dist\dlib-19.18.0\tools\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Charles\Downloads\dlib-19.18.0.tar\dist\dlib-19.18.0\build\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=C:\Users\Charles\AppData\Local\Programs\Python\Python37\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Charles\Downloads\dlib-19.18.0.tar\dist\dlib-19.18.0\build\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.

i also tried install it from source as :

python -m pip install  https://files.pythonhosted.org/packages/1e/62/aacb236d21fbd08148b1d517d58a9d80ea31bdcd386d26f21f8b23b1eb28/dlib-19.18.0.tar.gz#sha256=8ca127253a0ca82a3d847148515f82ff2c504ed77a6385ec4f38c7f8e5360860

it returning error as

Collecting https://files.pythonhosted.org/packages/1e/62/aacb236d21fbd08148b1d517d58a9d80ea31bdcd386d26f21f8b23b1eb28/dlib-19.18.0.tar.gz#sha256=8ca127253a0ca82a3d847148515f82ff2c504ed77a6385ec4f38c7f8e5360860
  Using cached dlib-19.18.0.tar.gz (3.1 MB)
Installing collected packages: dlib
    Running setup.py install for dlib ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:UsersCharlesAppDataLocalProgramsPythonPython37python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Charles\AppData\Local\Temp\pip-req-build-k3302dt_\setup.py'"'"'; __file__='"'"'C:\Users\Charles\AppData\Local\Temp\pip-req-build-k3302dt_\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersCharlesAppDataLocalTemppip-record-waso8gw6install-record.txt' --single-version-externally-managed --compile --install-headers 'C:UsersCharlesAppDataLocalProgramsPythonPython37Includedlib'
         cwd: C:UsersCharlesAppDataLocalTemppip-req-build-k3302dt_
    Complete output (74 lines):
    running install
    running build
    running build_py
    package init file 'dlib__init__.py' not found (or not a regular file)
    running build_ext
    Building extension for Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)]
    Invoking CMake setup: 'cmake C:UsersCharlesAppDataLocalTemppip-req-build-k3302dt_toolspython -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:UsersCharlesAppDataLocalTemppip-req-build-k3302dt_buildlib.win-amd64-3.7 -DPYTHON_EXECUTABLE=C:UsersCharlesAppDataLocalProgramsPythonPython37python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:UsersCharlesAppDataLocalTemppip-req-build-k3302dt_buildlib.win-amd64-3.7 -A x64'
    -- Building for: Visual Studio 10 2010
    CMake Error at CMakeLists.txt:3 (project):
      Failed to run MSBuild command:

        C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe

      to get the value of VCTargetsPath:

        Microsoft (R) Build Engine version 4.8.3752.0
        [Microsoft .NET Framework, version 4.0.30319.42000]
        Copyright (C) Microsoft Corporation. All rights reserved.

        Build started 2/7/2020 12:53:19 PM.
        Project "C:UsersCharlesAppDataLocalTemppip-req-build-k3302dt_buildtemp.win-amd64-3.7ReleaseCMakeFiles3.16.3VCTargetsPath.vcxproj" on node 1 (default targets).
        C:UsersCharlesAppDataLocalTemppip-req-build-k3302dt_buildtemp.win-amd64-3.7ReleaseCMakeFiles3.16.3VCTargetsPath.vcxproj(14,2): error MSB4019: The imported project "C:Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
        Done Building Project "C:UsersCharlesAppDataLocalTemppip-req-build-k3302dt_buildtemp.win-amd64-3.7ReleaseCMakeFiles3.16.3VCTargetsPath.vcxproj" (default targets) -- FAILED.

        Build FAILED.

        "C:UsersCharlesAppDataLocalTemppip-req-build-k3302dt_buildtemp.win-amd64-3.7ReleaseCMakeFiles3.16.3VCTargetsPath.vcxproj" (default target) (1) ->
          C:UsersCharlesAppDataLocalTemppip-req-build-k3302dt_buildtemp.win-amd64-3.7ReleaseCMakeFiles3.16.3VCTargetsPath.vcxproj(14,2): error MSB4019: The imported project "C:Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

            0 Warning(s)
            1 Error(s)

        Time Elapsed 00:00:00.01


      Exit code: 1



    -- Configuring incomplete, errors occurred!
    See also "C:/Users/Charles/AppData/Local/Temp/pip-req-build-k3302dt_/build/temp.win-amd64-3.7/Release/CMakeFiles/CMakeOutput.log".
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:UsersCharlesAppDataLocalTemppip-req-build-k3302dt_setup.py", line 261, in <module>
        'Topic :: Software Development',
      File "C:UsersCharlesAppDataLocalProgramsPythonPython37libsite-packagessetuptools__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "C:UsersCharlesAppDataLocalProgramsPythonPython37libdistutilscore.py", line 148, in setup
        dist.run_commands()
      File "C:UsersCharlesAppDataLocalProgramsPythonPython37libdistutilsdist.py", line 966, in run_commands
        self.run_command(cmd)
      File "C:UsersCharlesAppDataLocalProgramsPythonPython37libdistutilsdist.py", line 985, in run_command
        cmd_obj.run()
      File "C:UsersCharlesAppDataLocalProgramsPythonPython37libsite-packagessetuptoolscommandinstall.py", line 61, in run
        return orig.install.run(self)
      File "C:UsersCharlesAppDataLocalProgramsPythonPython37libdistutilscommandinstall.py", line 545, in run
        self.run_command('build')
      File "C:UsersCharlesAppDataLocalProgramsPythonPython37libdistutilscmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:UsersCharlesAppDataLocalProgramsPythonPython37libdistutilsdist.py", line 985, in run_command
        cmd_obj.run()
      File "C:UsersCharlesAppDataLocalProgramsPythonPython37libdistutilscommandbuild.py", line 135, in run
        self.run_command(cmd_name)
      File "C:UsersCharlesAppDataLocalProgramsPythonPython37libdistutilscmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:UsersCharlesAppDataLocalProgramsPythonPython37libdistutilsdist.py", line 985, in run_command
        cmd_obj.run()
      File "C:UsersCharlesAppDataLocalTemppip-req-build-k3302dt_setup.py", line 135, in run
        self.build_extension(ext)
      File "C:UsersCharlesAppDataLocalTemppip-req-build-k3302dt_setup.py", line 172, in build_extension
        subprocess.check_call(cmake_setup, cwd=build_folder)
      File "C:UsersCharlesAppDataLocalProgramsPythonPython37libsubprocess.py", line 347, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', 'C:\Users\Charles\AppData\Local\Temp\pip-req-build-k3302dt_\tools\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Charles\AppData\Local\Temp\pip-req-build-k3302dt_\build\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=C:\Users\Charles\AppData\Local\Programs\Python\Python37\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Charles\AppData\Local\Temp\pip-req-build-k3302dt_\build\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:UsersCharlesAppDataLocalProgramsPythonPython37python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Charles\AppData\Local\Temp\pip-req-build-k3302dt_\setup.py'"'"'; __file__='"'"'C:\Users\Charles\AppData\Local\Temp\pip-req-build-k3302dt_\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersCharlesAppDataLocalTemppip-record-waso8gw6install-record.txt' --single-version-externally-managed --compile --install-headers 'C:UsersCharlesAppDataLocalProgramsPythonPython37Includedlib' Check the logs for full command output.

Im so lost, any response or suggestions will be appreciated so much. Thank you

Solution

You have figured it out yourself, but I wanted to add some remarks on your installation methods:

pip install dlib

As there is only the tar.gz on pypi, it downloads that and then tries to run setup.py after installing the reuqirements

Therefore, you manually doing the tar.gz, extracting it and running python setup.py install is the same thing as the first command and also

python -m pip install  https://files.pythonhosted.org/packages/1e/62/aacb236d21fbd08148b1d517d58a9d80ea31bdcd386d26f21f8b23b1eb28/dlib-19.18.0.tar.gz

Is doing the same in the end, trying to run setup.py to install.

In this case it involves the compilation of c/c++ code which requires for the right compiler/build tools to be installed which pip cannot take care of. It is not built for this task.

Answered By — FlyingTeller

I was trying to install dlib library for face recognition in pycharm,

pip install dlib

I’m using virtual environment and base interpreter is C:UsersAyushmanAppDataLocalProgramsPythonPython38-32python.exe

Already installed cmake and pip.

python—version 3.8.3

pip—version 20.1.1

When I tried to install from setting, I got this error message:

Try to run this command from the system terminal. Make sure that you use the correct version of 'pip' installed for your Python interpreter located at 'C:UsersAyushmanPycharmProjectsdemoProjectvenvScriptspython.exe'. 

When I used terminal, I got this error message:

Collecting dlib
  Using cached dlib-19.19.0.tar.gz (3.2 MB)
Using legacy setup.py install for dlib, since package 'wheel' is not installed.
Installing collected packages: dlib
    Running setup.py install for dlib ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:usersayushmanpycharmprojectsdemoprojectvenvscriptspython.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Ayushman
\AppData\Local\Temp\pip-install-7crglpz8\dlib\setup.py'"'"'; __file__='"'"'C:\Users\Ayushman\AppData\Local\Temp\pip-install-7crglpz8\dlib\setup.py'"'"'
;f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' ins
tall --record 'C:UsersAyushmanAppDataLocalTemppip-record-id9u7hlkinstall-record.txt' --single-version-externally-managed --compile --install-headers 'c:users
ayushmanpycharmprojectsdemoprojectvenvincludesitepython3.8dlib'
         cwd: C:UsersAyushmanAppDataLocalTemppip-install-7crglpz8dlib
    Complete output (80 lines):
    running install
    running build
    running build_py
    package init file 'dlib__init__.py' not found (or not a regular file)
    running build_ext
    Building extension for Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)]
    Invoking CMake setup: 'cmake C:UsersAyushmanAppDataLocalTemppip-install-7crglpz8dlibtoolspython -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:UsersAyushmanAppDa
taLocalTemppip-install-7crglpz8dlibbuildlib.win32-3.8 -DPYTHON_EXECUTABLE=c:usersayushmanpycharmprojectsdemoprojectvenvscriptspython.exe -DCMAKE_LIBRARY
_OUTPUT_DIRECTORY_RELEASE=C:UsersAyushmanAppDataLocalTemppip-install-7crglpz8dlibbuildlib.win32-3.8'
    -- Building for: NMake Makefiles
    -- The C compiler identification is unknown
    -- The CXX compiler identification is unknown
    CMake Error at CMakeLists.txt:3 (project):
      The CMAKE_C_COMPILER:
    
        cl
    
      is not a full path and was not found in the PATH.
    
      To use the NMake generator with Visual C++, cmake must be run from a shell
      that can use the compiler cl from the command line.  This environment is
      unable to invoke the cl compiler.  To fix this problem, run cmake from the
      Visual Studio Command Prompt (vcvarsall.bat).
    
      Tell CMake where to find the compiler by setting either the environment
      variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
      the compiler, or to the compiler name if it is in the PATH.
    
    
    CMake Error at CMakeLists.txt:3 (project):
      The CMAKE_CXX_COMPILER:
    
        cl
    
      is not a full path and was not found in the PATH.
    
      To use the NMake generator with Visual C++, cmake must be run from a shell
      that can use the compiler cl from the command line.  This environment is
      unable to invoke the cl compiler.  To fix this problem, run cmake from the
      Visual Studio Command Prompt (vcvarsall.bat).
    
      Tell CMake where to find the compiler by setting either the environment
      variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
      to the compiler, or to the compiler name if it is in the PATH.
    
    
    -- Configuring incomplete, errors occurred!
    See also "C:/Users/Ayushman/AppData/Local/Temp/pip-install-7crglpz8/dlib/build/temp.win32-3.8/Release/CMakeFiles/CMakeOutput.log".
    See also "C:/Users/Ayushman/AppData/Local/Temp/pip-install-7crglpz8/dlib/build/temp.win32-3.8/Release/CMakeFiles/CMakeError.log".
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:UsersAyushmanAppDataLocalTemppip-install-7crglpz8dlibsetup.py", line 223, in <module>
        setup(
      File "c:usersayushmanpycharmprojectsdemoprojectvenvlibsite-packagessetuptools__init__.py", line 144, in setup
        return distutils.core.setup(**attrs)
      File "C:UsersAyushmanAppDataLocalProgramsPythonPython38-32libdistutilscore.py", line 148, in setup
        dist.run_commands()
      File "C:UsersAyushmanAppDataLocalProgramsPythonPython38-32libdistutilsdist.py", line 966, in run_commands
        self.run_command(cmd)
      File "C:UsersAyushmanAppDataLocalProgramsPythonPython38-32libdistutilsdist.py", line 985, in run_command
        cmd_obj.run()
      File "c:usersayushmanpycharmprojectsdemoprojectvenvlibsite-packagessetuptoolscommandinstall.py", line 61, in run
        return orig.install.run(self)
      File "C:UsersAyushmanAppDataLocalProgramsPythonPython38-32libdistutilscommandinstall.py", line 545, in run
        self.run_command('build')
      File "C:UsersAyushmanAppDataLocalProgramsPythonPython38-32libdistutilscmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:UsersAyushmanAppDataLocalProgramsPythonPython38-32libdistutilsdist.py", line 985, in run_command
        cmd_obj.run()
      File "C:UsersAyushmanAppDataLocalProgramsPythonPython38-32libdistutilscommandbuild.py", line 135, in run
        self.run_command(cmd_name)
      File "C:UsersAyushmanAppDataLocalProgramsPythonPython38-32libdistutilscmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:UsersAyushmanAppDataLocalProgramsPythonPython38-32libdistutilsdist.py", line 985, in run_command
        cmd_obj.run()
      File "C:UsersAyushmanAppDataLocalTemppip-install-7crglpz8dlibsetup.py", line 135, in run
        self.build_extension(ext)
      File "C:UsersAyushmanAppDataLocalTemppip-install-7crglpz8dlibsetup.py", line 172, in build_extension
        subprocess.check_call(cmake_setup, cwd=build_folder)
      File "C:UsersAyushmanAppDataLocalProgramsPythonPython38-32libsubprocess.py", line 364, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', 'C:\Users\Ayushman\AppData\Local\Temp\pip-install-7crglpz8\dlib\tools\python', '-DCMAKE_LIBRARY_OUTPUT
_DIRECTORY=C:\Users\Ayushman\AppData\Local\Temp\pip-install-7crglpz8\dlib\build\lib.win32-3.8', '-DPYTHON_EXECUTABLE=c:\users\ayushman\pycharmprojects\d
emoproject\venv\scripts\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Ayushman\AppData\Local\Temp\pip-install-7crglpz8\dlib\build\lib.w
in32-3.8']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:usersayushmanpycharmprojectsdemoprojectvenvscriptspython.exe' -u -c 'import sys, setuptools, tokenize; sys.a
rgv[0] = '"'"'C:\Users\Ayushman\AppData\Local\Temp\pip-install-7crglpz8\dlib\setup.py'"'"'; __file__='"'"'C:\Users\Ayushman\AppData\Local\Temp\pip-inst
all-7crglpz8\dlib\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code
, __file__, '"'"'exec'"'"'))' install --record 'C:UsersAyushmanAppDataLocalTemppip-record-id9u7hlkinstall-record.txt' --single-version-externally-managed --co
mpile --install-headers 'c:usersayushmanpycharmprojectsdemoprojectvenvincludesitepython3.8dlib' Check the logs for full command output.

Машинное обучение, Разработка под Windows, Python, Ненормальное программирование, Обработка изображений


Рекомендация: подборка платных и бесплатных курсов Python — https://katalog-kursov.ru/

Настройка программного обеспечения

Без промедления начнём. Нам нужно установить следующее ПО:

  • Windows 10

  • Anaconda 3 (Python 3.8)

  • Visual Studio 2019 (Community) — объясню позже, зачем она понадобится.

Открываем Anaconda Prompt (Anaconda3) и устанавливаем следующие пакеты:

pip install opencv-python
pip install dlib
pip install face_recognition

И уже на этом моменте начнутся проблемы с dlib.

Решаем проблему с dlib

Я перепробовал все решения, что нашёл в интернете и они оказались неактуальными — раз, два, три, официальное руководство и видео есть. Поэтому будем собирать пакет вручную.

Итак, первая же ошибка говорит о том, что у нас не установлен cmake.

ERROR: CMake must be installed to build dlib

ERROR: CMake must be installed to build dlib
ERROR: CMake must be installed to build dlib

Не закрывая консоль, вводим следующую команду:

pip install cmake

Проблем при установке быть не должно

Пробуем установить пакет той же командой (pip install dlib), но на этот раз получаем новую ошибку:

Отсутствуют элементы Visual Studio

Ошибка явно указывает, что у меня, скорее всего, стоит студия с элементами только для C# — и она оказывается права. Открываем Visual Studio Installer, выбираем «Изменить», в вкладке «Рабочие нагрузки» в разделе «Классические и мобильные приложения» выбираем пункт «Разработка классических приложений на С++»:

Пошагово

Почему важно оставить все галочки, которые предлагает Visual Studio. У меня с интернетом плоховато, поэтому я решил не скачивать пакет SDK для Windows, на что получил следующую ошибку:

Не нашли компилятор

Я начал искать решение этой ошибки, пробовать менять тип компилятора (cmake -G » Visual Studio 16 2019″), но только стоило установить SDK, как все проблемы ушли.

Я пробовал данный метод на двух ПК и отмечу ещё пару подводных камней. Самое главное — Visual Studio должна быть 2019 года. У меня под рукой был офлайн установщик только 2017 — я мигом его поставил, делаю команду на установку пакета и получаю ошибку, что нужна свежая Microsoft Visual C++ версии 14.0. Вторая проблема была связана с тем, что даже установленная студия не могла скомпилировать проект. Помогла дополнительная установка Visual C++ 2015 Build Tools и Microsoft Build Tools 2015.

Открываем вновь Anaconda Prompt, используем ту же самую команду и ждём, когда соберется проект (около 5 минут):

Сборка

Управляем громкостью

Вариантов оказалось несколько (ссылка), но чем проще — тем лучше. На русском язычном StackOverflow предложили использовать простую библиотеку от Paradoxis — ей и воспользуемся. Чтобы установить её, нам нужно скачать архив, пройти по пути C:ProgramDataAnaconda3Lib и перенести файлы keyboard.py, sound.py из архива. Проблем с использованием не возникало, поэтому идём дальше

Собираем события мыши

Самым популярным модулем для автоматизации управления мышью/клавиатурой оказался pynput. Устанавливаем так же через (pip install dlib). У модуля в целом неплохое описание — https://pynput.readthedocs.io/en/latest/mouse.html . Но у меня возникли сложности при получении событий. Я написал простую функцию:

from pynput import mouse

def func_mouse():
        with mouse.Events() as events:
            for event in events:
                if event:
                    print('Переместил мышку/нажал кнопку/скролл колесиком: {}n'.format(event))
                    print('Делаю половину громкости: ', time.ctime())
                    Sound.volume_set(volum_half)
                    break

В комментариях к статье придём к истине, как лучше сделать.

А что в итоге?

Adam Geitgey, автор библиотеки face recognition, в своём репозитории имеет очень хороший набор примеров, которые многие используют при написании статей: https://github.com/ageitgey/face_recognition/tree/master/examples

Воспользуемся одним из них и получим следующий код, который можно скачать по ссылке: Activity.ipynb, Activity.py

Код

# Подключаем нужные библиотеки
import cv2
import face_recognition
 
# Получаем данные с устройства (веб камера у меня всего одна, поэтому в аргументах 0)
video_capture = cv2.VideoCapture(0)
 
# Инициализируем переменные
face_locations = []

from sound import Sound
Sound.volume_up() # увеличим громкость на 2 единицы
current = Sound.current_volume() # текущая громкость, если кому-то нужно

volum_half=50  # 50% громкость
volum_full=100 # 100% громкость

Sound.volume_max() # выставляем сразу по максимуму


# Работа со временем

# Подключаем модуль для работы со временем
import time
# Подключаем потоки
from threading import Thread
import threading


# Функция для работы с активностью мыши
from pynput import mouse

def func_mouse():
        with mouse.Events() as events:
            for event in events:
                if event == mouse.Events.Scroll or mouse.Events.Click:
                    #print('Переместил мышку/нажал кнопку/скролл колесиком: {}n'.format(event))
                    print('Делаю половину громкости: ', time.ctime())
                    Sound.volume_set(volum_half)
                    break

# Делаем отдельную функцию с напоминанием
def not_find():
    #print("Cкрипт на 15 секунд начинается ", time.ctime())
    print('Делаю 100% громкости: ', time.ctime())
    #Sound.volume_set(volum_full)
    Sound.volume_max()
    
    # Секунды на выполнение
    #local_time = 15
    # Ждём нужное количество секунд, цикл в это время ничего не делает
    #time.sleep(local_time)
    
    # Вызываю функцию поиска действий по мышке
    func_mouse()
    #print("Cкрипт на 15 сек прошел")


# А тут уже основная часть кода

while True:
    ret, frame = video_capture.read()
    
    '''
    # Resize frame of video to 1/2 size for faster face recognition processing
    small_frame = cv2.resize(frame, (0, 0), fx=0.50, fy=0.50)
    rgb_frame = small_frame[:, :, ::-1]
    '''

    rgb_frame = frame[:, :, ::-1]
    
    face_locations = face_recognition.face_locations(rgb_frame)
    
    number_of_face = len(face_locations)
    
    '''
    #print("Я нашел {} лицо(лица) в данном окне".format(number_of_face))
    #print("Я нашел {} лицо(лица) в данном окне".format(len(face_locations)))
    '''
    
    if number_of_face < 1:
        print("Я не нашел лицо/лица в данном окне, начинаю работу:", time.ctime())
        '''
        th = Thread(target=not_find, args=()) # Создаём новый поток
        th.start() # И запускаем его
        # Пока работает поток, выведем на экран через 10 секунд, что основной цикл в работе
        '''
        #time.sleep(5)
        print("Поток мыши заработал в основном цикле: ", time.ctime())
        
        #thread = threading.Timer(60, not_find)
        #thread.start()
        
        not_find()
        '''
        thread = threading.Timer(60, func_mouse)
        thread.start()
        print("Поток мыши заработал.n")
        # Пока работает поток, выведем на экран через 10 секунд, что основной цикл в работе
        '''
        #time.sleep(10)
        print("Пока поток работает, основной цикл поиска лица в работе.n")
    else:
        #все хорошо, за ПК кто-то есть
        print("Я нашел лицо/лица в данном окне в", time.ctime())
        Sound.volume_set(volum_half)
        
    for top, right, bottom, left in face_locations:
        cv2.rectangle(frame, (left, top), (right, bottom), (0, 0, 255), 2)
    
    cv2.imshow('Video', frame)
    
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break


video_capture.release()
cv2.destroyAllWindows()

Суть кода предельно проста: бегаем в цикле, как только появилось хотя бы одно лицо (а точнее координаты), то звук делаем 50%. Если не нашёл никого поблизости, то запускаем цикл с мышкой.

Тестирование в бою

Ожидание и реальность

Если вы посмотрели видео, то поняли, что результат ещё далёк от реальной эксплуатации.

Признаю честно — до этого момента никогда не сталкивался с многопоточностью на Python, поэтому «с наскоку» тему взять не удалось и результат по видео понятен. Есть неплохая статья на Хабре, описывающая различные методы многопоточности, применяемые в языке. Пока у меня решения нету по этой теме нету — будет повод разобраться лучше и дописать код/статью с учетом этого.

Так же возникает закономерный вопрос — а если вместо живого человека поставить перед монитором картинку? Да, она распознает, что, скорее всего, не совсем верно. Мне попался очень хороший материал по поводу определения живого лица в реальном времени — https://www.machinelearningmastery.ru/real-time-face-liveness-detection-with-python-keras-and-opencv-c35dc70dafd3/ , но это уже немного другой уровень и думаю новичкам это будет посложнее. Но эксперименты с нейронными сетями я чуть позже повторю, чтобы тоже проверить верность и повторяемость данного руководства.

Немаловажным фактором на качество распознавания оказывает получаемое изображение с веб-камеры. Предложение использовать 1/4 изображения (сжатие его) приводит только к ухудшению — моё лицо алгоритм распознать так и не смог. Для повышения качества предлагают использовать MTCNN face detector (пример использования), либо что-нибудь посложнее из абзаца выше.

Другая интересная особенность — таймеры в Питоне. Я, опять же, признаю, что ни разу до этого не было нужды в них, но все статьях сводится к тому, чтобы ставить поток в sleep(кол-во секунд). А если мне нужно сделать так, чтобы основной поток был в работе, а по истечению n-ое количества секунд не было активности, то выполнялась моя функция? Использовать демонов (daemon)? Так это не совсем то, что нужно. Писать отдельную программу, которая взаимодействует с другой? Возможно, но единство программы пропадает.

Заключение

На своём примере могу точно сказать — не все руководства одинаково полезны и простая задача может перерасти в сложную. Я понимаю, что большинство материалов является переводом/простым копированием документации. Но если ты пишешь руководство, то проверь хотя бы на тестовой системе, что написанные тобой действия точно повторимы. Пробуйте, экспериментируйте — это хороший повод изучить и узнать новое.

P.S. Предлагаю вам, читатели, обсудить в комментариях статью — ваши идеи, замечания, уточнения.

Понравилась статья? Поделить с друзьями:
  • Physx error reinstalling the application may fix this problem
  • Pip install conda error
  • Physx error dark sector
  • Pip install catboost error
  • Physical kaslr disabled no suitable memory region как исправить