I wanted to work on a project involving face recognition, but when I tried to install face_recognition library, it gave me this output-
Collecting face_recognition
Using cached https://files.pythonhosted.org/packages/1e/95/f6c9330f54ab07bfa032bf3715c12455a381083125d8880c43cbe76bb3d0/face_recognition-1.3.0-py2.py3-none-any.whl
Collecting dlib>=19.7 (from face_recognition)
Using cached https://files.pythonhosted.org/packages/63/92/05c3b98636661cb80d190a5a777dd94effcc14c0f6893222e5ca81e74fbc/dlib-19.19.0.tar.gz
Collecting face-recognition-models>=0.3.0 (from face_recognition)
Using cached https://files.pythonhosted.org/packages/cf/3b/4fd8c534f6c0d1b80ce0973d01331525538045084c73c153ee6df20224cf/face_recognition_models-0.3.0.tar.gz
Collecting Click>=6.0 (from face_recognition)
Using cached https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl
Collecting numpy (from face_recognition)
Using cached https://files.pythonhosted.org/packages/14/ef/9f2eeb4ff0c733ad9149f17266e388c308e171fdb8c2415dbb472e2bbc0f/numpy-1.16.6-cp27-cp27m-win_amd64.whl
Collecting Pillow (from face_recognition)
Using cached https://files.pythonhosted.org/packages/5e/b6/8960697526a79bd1cb4520293078be3a10d725f23f20abbee298ebdeaabd/Pillow-6.2.2-cp27-cp27m-win_amd64.whl
Installing collected packages: dlib, face-recognition-models, Click, numpy, Pillow, face-recognition
Running setup.py install for dlib ... error
ERROR: Command errored out with exit status 1:
command: 'c:\python27\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'c:\\users\\adity\\appdata\\local\\temp\\pip-install-rosjjw\\dlib\\setup.py'"'"'; __file__='"'"'c:\\users\\adity\\appdata\\local\\temp\\pip-install-rosjjw\\dlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'c:\users\adity\appdata\local\temp\pip-record-jqvmxp\install-record.txt' --single-version-externally-managed --compile
cwd: c:\users\adity\appdata\local\temp\pip-install-rosjjw\dlib\
Complete output (40 lines):
running install
running build
running build_py
package init file 'dlib\__init__.py' not found (or not a regular file)
running build_ext
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\adity\appdata\local\temp\pip-install-rosjjw\dlib\setup.py", line 261, in <module>
'Topic :: Software Development',
File "c:\python27\lib\site-packages\setuptools\__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "c:\python27\lib\distutils\core.py", line 151, in setup
dist.run_commands()
File "c:\python27\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "c:\python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "c:\python27\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "c:\python27\lib\distutils\command\install.py", line 563, in run
self.run_command('build')
File "c:\python27\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "c:\python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "c:\python27\lib\distutils\command\build.py", line 127, in run
self.run_command(cmd_name)
File "c:\python27\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "c:\python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "c:\users\adity\appdata\local\temp\pip-install-rosjjw\dlib\setup.py", line 129, in run
cmake_version = self.get_cmake_version()
File "c:\users\adity\appdata\local\temp\pip-install-rosjjw\dlib\setup.py", line 125, in get_cmake_version
"\n*******************************************************************\n")
RuntimeError:
*******************************************************************
CMake must be installed to build the following extensions: dlib
*******************************************************************
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\python27\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'c:\\users\\adity\\appdata\\local\\temp\\pip-install-rosjjw\\dlib\\setup.py'"'"'; __file__='"'"'c:\\users\\adity\\appdata\\local\\temp\\pip-install-rosjjw\\dlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'c:\users\adity\appdata\local\temp\pip-record-jqvmxp\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
How can I fix this? In Windows 10?
*I guess I have to install Cmake and Dlib, but it's giving the same error
(python 3.6.8)
RuntimeError:
*******************************************************************
CMake must be installed to build the following extensions: dlib
*******************************************************************
I ran into the same problem recently, I resolved it downloading CMAKE.
Here is the link to download it for each OS
Related
Facing the following error while installing dlib for the OpenCV project. It shows that
CMake must be installed to build the following extensions: dlib.
Command Output:
Collecting dlib==19.18.0
Using cached dlib-19.18.0.tar.gz (3.1 MB)
Using legacy 'setup.py install' for dlib, since package 'wheel' is not installed.
Installing collected packages: dlib
Running setup.py install for dlib: started
Running setup.py install for dlib: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: 'D:\Install Drive\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\mahmu\\AppData\\Local\\Temp\\pip-install-a4s1a_zh\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\mahmu\\AppData\\Local\\Temp\\pip-install-a4s1a_zh\\dlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\mahmu\AppData\Local\Temp\pip-record-mjm6k3c3\install-record.txt' --single-version-externally-managed --compile --install-headers 'D:\Install Drive\Include\dlib'
cwd: C:\Users\mahmu\AppData\Local\Temp\pip-install-a4s1a_zh\dlib\
Complete output (57 lines):
running install
running build
running build_py
package init file 'dlib\__init__.py' not found (or not a regular file)
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
Traceback (most recent call last):
File "C:\Users\mahmu\AppData\Local\Temp\pip-install-a4s1a_zh\dlib\setup.py", line 120, in get_cmake_version
out = subprocess.check_output(['cmake', '--version'])
File "D:\Install Drive\lib\subprocess.py", line 424, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "D:\Install Drive\lib\subprocess.py", line 505, in run
with Popen(*popenargs, **kwargs) as process:
File "D:\Install Drive\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "D:\Install Drive\lib\subprocess.py", line 1420, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\mahmu\AppData\Local\Temp\pip-install-a4s1a_zh\dlib\setup.py", line 223, in <module>
setup(
File "D:\Install Drive\lib\site-packages\setuptools\__init__.py", line 165, in setup
return distutils.core.setup(**attrs)
File "D:\Install Drive\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "D:\Install Drive\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "D:\Install Drive\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "D:\Install Drive\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "D:\Install Drive\lib\distutils\command\install.py", line 546, in run
self.run_command('build')
File "D:\Install Drive\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "D:\Install Drive\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "D:\Install Drive\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "D:\Install Drive\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "D:\Install Drive\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\mahmu\AppData\Local\Temp\pip-install-a4s1a_zh\dlib\setup.py", line 129, in run
cmake_version = self.get_cmake_version()
File "C:\Users\mahmu\AppData\Local\Temp\pip-install-a4s1a_zh\dlib\setup.py", line 122, in get_cmake_version
raise RuntimeError("\n*******************************************************************\n" +
RuntimeError:
*******************************************************************
CMake must be installed to build the following extensions: dlib
*******************************************************************
----------------------------------------
ERROR: Command errored out with exit status 1: 'D:\Install Drive\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\mahmu\\AppData\\Local\\Temp\\pip-install-a4s1a_zh\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\mahmu\\AppData\\Local\\Temp\\pip-install-a4s1a_zh\\dlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\mahmu\AppData\Local\Temp\pip-record-mjm6k3c3\install-record.txt' --single-version-externally-managed --compile --install-headers 'D:\Install Drive\Include\dlib' Check the logs for full command output.
WARNING: You are using pip version 20.2.3; however, version 21.1.2 is available.
You should consider upgrading via the 'D:\Install Drive\python.exe -m pip install --upgrade pip' command.
Notice that in the output that "CMake must be installed to build the following extensions: dlib". So install CMake first and only then try to install dlib. If CMake is installed, try updating your pip version to 21.1.2 via "D:\Install Drive\python.exe -m pip install --upgrade pip".
It requires cmake must be installed before installing dlib. Do execute in the following order.
pip install cmake
pip install dlib
This will fix the issue.
C:\WINDOWS\system32>pip install face-recognition
Collecting face-recognition
Using cached face_recognition-1.3.0-py2.py3-none-any.whl (15 kB)
Requirement already satisfied: numpy in c:\users\dell\appdata\local\programs\python\python38-32\lib\site-packages (from face-recognition) (1.19.1)
Requirement already satisfied: face-recognition-models>=0.3.0 in c:\users\dell\appdata\local\programs\python\python38-32\lib\site-packages (from face-recognition) (0.3.0)
Requirement already satisfied: Pillow in c:\users\dell\appdata\local\programs\python\python38-32\lib\site-packages (from face-recognition) (7.2.0)
Collecting dlib>=19.7
Using cached dlib-19.21.0.tar.gz (3.2 MB)
Requirement already satisfied: Click>=6.0 in c:\users\dell\appdata\local\programs\python\python38-32\lib\site-packages (from face-recognition) (7.1.2)
Building wheels for collected packages: dlib
Building wheel for dlib (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\dell\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\DELL\\AppData\\Local\\Temp\\pip-install-ffmft1wf\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\DELL\\AppData\\Local\\Temp\\pip-install-ffmft1wf\\dlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\DELL\AppData\Local\Temp\pip-wheel-xf9e0i7s'
cwd: C:\Users\DELL\AppData\Local\Temp\pip-install-ffmft1wf\dlib\
Complete output (58 lines):
running bdist_wheel
running build
running build_py
package init file 'tools\python\dlib\__init__.py' not found (or not a regular file)
running build_ext
Building extension for Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 bit (Intel)]
Invoking CMake setup: 'cmake C:\Users\DELL\AppData\Local\Temp\pip-install-ffmft1wf\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\DELL\AppData\Local\Temp\pip-install-ffmft1wf\dlib\build\lib.win32-3.8 -DPYTHON_EXECUTABLE=c:\users\dell\appdata\local\programs\python\python38-32\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\DELL\AppData\Local\Temp\pip-install-ffmft1wf\dlib\build\lib.win32-3.8'
-- 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\DELL\AppData\Local\Temp\pip-install-ffmft1wf\dlib\setup.py", line 223, in <module>
setup(
File "c:\users\dell\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "c:\users\dell\appdata\local\programs\python\python38-32\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\dell\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\users\dell\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\dell\appdata\local\programs\python\python38-32\lib\site-packages\wheel\bdist_wheel.py", line 290, in run
self.run_command('build')
File "c:\users\dell\appdata\local\programs\python\python38-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\dell\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\dell\appdata\local\programs\python\python38-32\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\dell\appdata\local\programs\python\python38-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\dell\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\DELL\AppData\Local\Temp\pip-install-ffmft1wf\dlib\setup.py", line 135, in run
self.build_extension(ext)
File "C:\Users\DELL\AppData\Local\Temp\pip-install-ffmft1wf\dlib\setup.py", line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\users\dell\appdata\local\programs\python\python38-32\lib\subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\DELL\\AppData\\Local\\Temp\\pip-install-ffmft1wf\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\DELL\\AppData\\Local\\Temp\\pip-install-ffmft1wf\\dlib\\build\\lib.win32-3.8', '-DPYTHON_EXECUTABLE=c:\\users\\dell\\appdata\\local\\programs\\python\\python38-32\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\DELL\\AppData\\Local\\Temp\\pip-install-ffmft1wf\\dlib\\build\\lib.win32-3.8']' 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, face-recognition
Running setup.py install for dlib ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\dell\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\DELL\\AppData\\Local\\Temp\\pip-install-ffmft1wf\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\DELL\\AppData\\Local\\Temp\\pip-install-ffmft1wf\\dlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\DELL\AppData\Local\Temp\pip-record-k_fgj9zq\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\dell\appdata\local\programs\python\python38-32\Include\dlib'
cwd: C:\Users\DELL\AppData\Local\Temp\pip-install-ffmft1wf\dlib\
Complete output (60 lines):
running install
running build
running build_py
package init file 'tools\python\dlib\__init__.py' not found (or not a regular file)
running build_ext
Building extension for Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 bit (Intel)]
Invoking CMake setup: 'cmake C:\Users\DELL\AppData\Local\Temp\pip-install-ffmft1wf\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\DELL\AppData\Local\Temp\pip-install-ffmft1wf\dlib\build\lib.win32-3.8 -DPYTHON_EXECUTABLE=c:\users\dell\appdata\local\programs\python\python38-32\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\DELL\AppData\Local\Temp\pip-install-ffmft1wf\dlib\build\lib.win32-3.8'
-- 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\DELL\AppData\Local\Temp\pip-install-ffmft1wf\dlib\setup.py", line 223, in <module>
setup(
File "c:\users\dell\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "c:\users\dell\appdata\local\programs\python\python38-32\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\dell\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\users\dell\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\dell\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "c:\users\dell\appdata\local\programs\python\python38-32\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "c:\users\dell\appdata\local\programs\python\python38-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\dell\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\dell\appdata\local\programs\python\python38-32\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\dell\appdata\local\programs\python\python38-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\dell\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\DELL\AppData\Local\Temp\pip-install-ffmft1wf\dlib\setup.py", line 135, in run
self.build_extension(ext)
File "C:\Users\DELL\AppData\Local\Temp\pip-install-ffmft1wf\dlib\setup.py", line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\users\dell\appdata\local\programs\python\python38-32\lib\subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\DELL\\AppData\\Local\\Temp\\pip-install-ffmft1wf\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\DELL\\AppData\\Local\\Temp\\pip-install-ffmft1wf\\dlib\\build\\lib.win32-3.8', '-DPYTHON_EXECUTABLE=c:\\users\\dell\\appdata\\local\\programs\\python\\python38-32\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\DELL\\AppData\\Local\\Temp\\pip-install-ffmft1wf\\dlib\\build\\lib.win32-3.8']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\dell\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\DELL\\AppData\\Local\\Temp\\pip-install-ffmft1wf\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\DELL\\AppData\\Local\\Temp\\pip-install-ffmft1wf\\dlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\DELL\AppData\Local\Temp\pip-record-k_fgj9zq\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\dell\appdata\local\programs\python\python38-32\Include\dlib' Check the logs for full command output.
Have you try this steps? Face-recognition on windows
Officially this package is not supporting windows but this steps might be help you.
Also the another way is you can download it's environment with virtual box on windows system. From here pre-configured VM
I guess it will help you. Thank you
Why don't you adopt deepface? It is more lightweight and it covers Keras based facial recognition models. In other words, it is easier to install and run.
#!pip install deepface
from deepface import DeepFace
models = ["VGG-Face", "Facenet", "OpenFace", "DeepFace", "DeepID"]
res = DeepFace.verify("img1.jpg", "img2.jpg", model_name = models[0])
I am using python3.6 and have installed dlib using its wheel file dlib-19.8.1-cp36-cp36m-win_amd64.whl on windows 10 x64. This wheel file installed dlib but the version installed is 19.8.1. I want to upgrade it to 19.20 which is the latest version. To do this, I am using upgrade command python -m pip install dlib --upgrade but this gives me below error:
Collecting dlib
Using cached dlib-19.20.0.tar.gz (3.2 MB)
Using legacy setup.py install for dlib, since package 'wheel' is not installed.
Installing collected packages: dlib
Attempting uninstall: dlib
Found existing installation: dlib 19.8.1
Uninstalling dlib-19.8.1:
Successfully uninstalled dlib-19.8.1
Running setup.py install for dlib ... error
ERROR: Command errored out with exit status 1:
command: 'c:\python3.6\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ABHINA~1\\AppData\\Local\\Temp\\pip-install-erx7t440\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\ABHINA~1\\AppData\\Local\\Temp\\pip-install-erx7t440\\dlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\ABHINA~1\AppData\Local\Temp\pip-record-qdwn8ssd\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python3.6\Include\dlib'
cwd: C:\Users\ABHINA~1\AppData\Local\Temp\pip-install-erx7t440\dlib\
Complete output (55 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.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\ABHINA~1\AppData\Local\Temp\pip-install-erx7t440\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\ABHINA~1\AppData\Local\Temp\pip-install-erx7t440\dlib\build\lib.win-amd64-3.6 -DPYTHON_EXECUTABLE=c:\python3.6\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\ABHINA~1\AppData\Local\Temp\pip-install-erx7t440\dlib\build\lib.win-amd64-3.6 -A x64'
-- Building for: NMake Makefiles
CMake Error at CMakeLists.txt:3 (project):
Generator
NMake Makefiles
does not support platform specification, but platform
x64
was specified.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "C:/Users/AbhinavRawat/AppData/Local/Temp/pip-install-erx7t440/dlib/build/temp.win-amd64-3.6/Release/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\ABHINA~1\AppData\Local\Temp\pip-install-erx7t440\dlib\setup.py", line 261, in <module>
'Topic :: Software Development',
File "c:\python3.6\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\python3.6\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "c:\python3.6\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\python3.6\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "c:\python3.6\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "c:\python3.6\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\python3.6\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\python3.6\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\python3.6\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\python3.6\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\ABHINA~1\AppData\Local\Temp\pip-install-erx7t440\dlib\setup.py", line 135, in run
self.build_extension(ext)
File "C:\Users\ABHINA~1\AppData\Local\Temp\pip-install-erx7t440\dlib\setup.py", line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\python3.6\lib\subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\ABHINA~1\\AppData\\Local\\Temp\\pip-install-erx7t440\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\ABHINA~1\\AppData\\Local\\Temp\\pip-install-erx7t440\\dlib\\build\\lib.win-amd64-3.6', '-DPYTHON_EXECUTABLE=c:\\python3.6\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\ABHINA~1\\AppData\\Local\\Temp\\pip-install-erx7t440\\dlib\\build\\lib.win-amd64-3.6', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
Rolling back uninstall of dlib
Moving to c:\python3.6\lib\site-packages\dlib-19.8.1.dist-info\
from c:\python3.6\lib\site-packages\~lib-19.8.1.dist-info
Moving to c:\python3.6\lib\site-packages\dlib\
from c:\python3.6\lib\site-packages\~lib
ERROR: Command errored out with exit status 1: 'c:\python3.6\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ABHINA~1\\AppData\\Local\\Temp\\pip-install-erx7t440\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\ABHINA~1\\AppData\\Local\\Temp\\pip-install-erx7t440\\dlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\ABHINA~1\AppData\Local\Temp\pip-record-qdwn8ssd\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python3.6\Include\dlib' Check the logs for full command output.
Can anyone please help me here. Thanks
pip install dlib==19.8.1 it should install this version
I can't install python net everything in previous solutions I have followed through and it still doesn't work.
I have tried everything. Do I need to uninstall python and do it again?
pip install pyhtonnet
ERROR: Could not find a version that satisfies the requirement pyhtonnet (from versions: none)
ERROR: No matching distribution found for pyhtonnet
C:\Users\vishv>pip install pythonnet
Collecting pythonnet
Using cached pythonnet-2.4.0.tar.gz (1.8 MB)
Building wheels for collected packages: pythonnet
Building wheel for pythonnet (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\vishv\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\vishv\AppData\Local\Temp\pip-install-pwmwkrlc\pythonnet\setup.py'"'"'; file='"'"'C:\Users\vishv\AppData\Local\Temp\pip-install-pwmwkrlc\pythonnet\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\vishv\AppData\Local\Temp\pip-wheel-qw1gpb32'
cwd: C:\Users\vishv\AppData\Local\Temp\pip-install-pwmwkrlc\pythonnet
Complete output (69 lines):
running bdist_wheel
running build
running build_ext
Checking for updates from https://www.nuget.org/api/v2/.
Currently running NuGet.exe 4.1.0.
Updating NuGet.exe to 5.4.0.
Update successful.
Cannot find the specified version of msbuild: '14'
MSBuild auto-detection: using msbuild version '4.0' from 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319'.
Restoring NuGet package NUnit.3.7.1.
Restoring NuGet package NUnit.ConsoleRunner.3.7.0.
Restoring NuGet package UnmanagedExports.1.2.7.
Adding package 'NUnit.ConsoleRunner.3.7.0' to folder 'C:\Users\vishv\AppData\Local\Temp\pip-install-pwmwkrlc\pythonnet\packages'
Adding package 'NUnit.3.7.1' to folder 'C:\Users\vishv\AppData\Local\Temp\pip-install-pwmwkrlc\pythonnet\packages'
Adding package 'UnmanagedExports.1.2.7' to folder 'C:\Users\vishv\AppData\Local\Temp\pip-install-pwmwkrlc\pythonnet\packages'
Added package 'UnmanagedExports.1.2.7' to folder 'C:\Users\vishv\AppData\Local\Temp\pip-install-pwmwkrlc\pythonnet\packages'
Added package 'NUnit.ConsoleRunner.3.7.0' to folder 'C:\Users\vishv\AppData\Local\Temp\pip-install-pwmwkrlc\pythonnet\packages'
Added package 'NUnit.3.7.1' to folder 'C:\Users\vishv\AppData\Local\Temp\pip-install-pwmwkrlc\pythonnet\packages'
NuGet Config files used:
C:\Users\vishv\AppData\Roaming\NuGet\NuGet.Config
Feeds used:
C:\Users\vishv.nuget\packages
https://api.nuget.org/v3/index.json
Installed:
3 package(s) to packages.config projects
Traceback (most recent call last):
File "tools\geninterop\geninterop.py", line 24, in
from pycparser import c_ast, c_parser
ModuleNotFoundError: No module named 'pycparser'
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\vishv\AppData\Local\Temp\pip-install-pwmwkrlc\pythonnet\setup.py", line 623, in
setup(
File "c:\users\vishv\appdata\local\programs\python\python38\lib\site-packages\setuptools_init_.py", line 144, in setup
return distutils.core.setup(**attrs)
File "c:\users\vishv\appdata\local\programs\python\python38\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\vishv\appdata\local\programs\python\python38\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\users\vishv\appdata\local\programs\python\python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\vishv\AppData\Local\Temp\pip-install-pwmwkrlc\pythonnet\setup.py", line 610, in run
return bdist_wheel.bdist_wheel.run(self)
File "c:\users\vishv\appdata\local\programs\python\python38\lib\site-packages\wheel\bdist_wheel.py", line 223, in run
self.run_command('build')
File "c:\users\vishv\appdata\local\programs\python\python38\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\vishv\appdata\local\programs\python\python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\vishv\appdata\local\programs\python\python38\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\vishv\appdata\local\programs\python\python38\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\vishv\appdata\local\programs\python\python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\vishv\appdata\local\programs\python\python38\lib\distutils\command\build_ext.py", line 340, in run
self.build_extensions()
File "c:\users\vishv\appdata\local\programs\python\python38\lib\distutils\command\build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "c:\users\vishv\appdata\local\programs\python\python38\lib\distutils\command\build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "C:\Users\vishv\AppData\Local\Temp\pip-install-pwmwkrlc\pythonnet\setup.py", line 298, in build_extension
subprocess.check_call([sys.executable, geninterop, interop_file])
File "c:\users\vishv\appdata\local\programs\python\python38\lib\subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['c:\users\vishv\appdata\local\programs\python\python38\python.exe', 'tools\geninterop\geninterop.py', 'src\runtime\interop38.cs']' returned non-zero exit status 1.
ERROR: Failed building wheel for pythonnet
Running setup.py clean for pythonnet
Failed to build pythonnet
Installing collected packages: pythonnet
Running setup.py install for pythonnet ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\vishv\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\vishv\AppData\Local\Temp\pip-install-pwmwkrlc\pythonnet\setup.py'"'"'; file='"'"'C:\Users\vishv\AppData\Local\Temp\pip-install-pwmwkrlc\pythonnet\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\vishv\AppData\Local\Temp\pip-record-h9hrt2n6\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\vishv\appdata\local\programs\python\python38\Include\pythonnet'
cwd: C:\Users\vishv\AppData\Local\Temp\pip-install-pwmwkrlc\pythonnet
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: option --single-version-externally-managed not recognized
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\vishv\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\vishv\AppData\Local\Temp\pip-install-pwmwkrlc\pythonnet\setup.py'"'"'; file='"'"'C:\Users\vishv\AppData\Local\Temp\pip-install-pwmwkrlc\pythonnet\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\vishv\AppData\Local\Temp\pip-record-h9hrt2n6\install-record.txt' --single-version-externally-managed --compile --install-headers
Have you tried installing python 3.7 instead of 3.8? I just ran into a similar error with 3.8 but no problems with 3.7 (and upgraded pip and setuptools). Seems like 3.8. will only work with pythonnet version >= 2.5
When installing face-recognition in Windows I'm getting the following traceback:
C:\Windows\system32>pip install face-recognition
Collecting face-recognition
Using cached https://files.pythonhosted.org/packages/3f/ed/ad9a28042f373d4633fc8b49109b623597d6f193d3bbbef7780a5ee8eef2/face_recognition-1.2.3-py2.py3-none-any.whl
Requirement already satisfied: numpy in c:\program files\python37\lib\site-packages (from face-recognition) (1.16.4)
Requirement already satisfied: Click>=6.0 in c:\program files\python37\lib\site-packages (from face-recognition) (7.0)
Collecting dlib>=19.7 (from face-recognition)
Using cached https://files.pythonhosted.org/packages/05/57/e8a8caa3c89a27f80bc78da39c423e2553f482a3705adc619176a3a24b36/dlib-19.17.0.tar.gz
Requirement already satisfied: Pillow in c:\program files\python37\lib\site-packages (from face-recognition) (6.0.0)
Requirement already satisfied: face-recognition-models>=0.3.0 in c:\program files\python37\lib\site-packages (from face-recognition) (0.3.0)
Installing collected packages: dlib, face-recognition
Running setup.py install for dlib ... error
ERROR: Command errored out with exit status 1:
command: 'c:\program files\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Erfan\\AppData\\Local\\Temp\\pip-install-kkt88o4h\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\Erfan\\AppData\\Local\\Temp\\pip-install-kkt88o4h\\dlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Erfan\AppData\Local\Temp\pip-record-7hhzklek\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\Erfan\AppData\Local\Temp\pip-install-kkt88o4h\dlib\
Complete output (57 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.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\Erfan\AppData\Local\Temp\pip-install-kkt88o4h\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Erfan\AppData\Local\Temp\pip-install-kkt88o4h\dlib\build\lib.win-amd64-3.7 -DPYTHON_EXECUTABLE=c:\program files\python37\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Erfan\AppData\Local\Temp\pip-install-kkt88o4h\dlib\build\lib.win-amd64-3.7 -A x64'
-- Building for: NMake Makefiles
CMake Error in CMakeLists.txt:
Generator
NMake Makefiles
does not support platform specification, but platform
x64
was specified.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "C:/Users/Erfan/AppData/Local/Temp/pip-install-kkt88o4h/dlib/build/temp.win-amd64-3.7/Release/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Erfan\AppData\Local\Temp\pip-install-kkt88o4h\dlib\setup.py", line 261, in <module>
'Topic :: Software Development',
File "c:\program files\python37\lib\site-packages\setuptools\__init__.py", line 143, in setup
return distutils.core.setup(**attrs)
File "c:\program files\python37\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\program files\python37\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\program files\python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\program files\python37\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "c:\program files\python37\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "c:\program files\python37\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\program files\python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\program files\python37\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\program files\python37\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\program files\python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\Erfan\AppData\Local\Temp\pip-install-kkt88o4h\dlib\setup.py", line 135, in run
self.build_extension(ext)
File "C:\Users\Erfan\AppData\Local\Temp\pip-install-kkt88o4h\dlib\setup.py", line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\program files\python37\lib\subprocess.py", line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\Erfan\\AppData\\Local\\Temp\\pip-install-kkt88o4h\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\Erfan\\AppData\\Local\\Temp\\pip-install-kkt88o4h\\dlib\\build\\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=c:\\program files\\python37\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\Erfan\\AppData\\Local\\Temp\\pip-install-kkt88o4h\\dlib\\build\\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\program files\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Erfan\\AppData\\Local\\Temp\\pip-install-kkt88o4h\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\Erfan\\AppData\\Local\\Temp\\pip-install-kkt88o4h\\dlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Erfan\AppData\Local\Temp\pip-record-7hhzklek\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
Looks like you are getting the error when you are installing dlib which is a prerequisite for face recognition. Since you are trying to install it on windows, there are certain prerequisites which you must ensure.
1. You will need to download cmake and install it and ensure the path is set in your environment variables.
2. You will need to have VS 2015/2017 installed.
I have not been able to get dlib working with VS2019 so far and I am not sure if it works well, hence use either 2015/2017.
Then download dlib from their github link and manually build the library instead of doing pip install.
Once dlib is installed you will then be able to install face-recognition using pip