Installing DLIB , TensorFlow and Face-Recognition error in Windows - python

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])

Related

how to solve Dlib visual studios c++ error?

C:\Users\User_01>pip install dlib
Defaulting to user installation because normal site-packages is not writeable
Collecting dlib
Using cached dlib-19.21.1.tar.gz (3.6 MB)
Building wheels for collected packages: dlib
Building wheel for dlib (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\program files\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\User_01\\AppData\\Local\\Temp\\pip-install-trf2srgw\\dlib_042210a71f3f4d22994c8640d6338561\\setup.py'"'"'; __file__='"'"'C:\\Users\\User_01\\AppData\\Local\\Temp\\pip-install-trf2srgw\\dlib_042210a71f3f4d22994c8640d6338561\\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\User_01\AppData\Local\Temp\pip-wheel-u114ylxx'
cwd: C:\Users\User_01\AppData\Local\Temp\pip-install-trf2srgw\dlib_042210a71f3f4d22994c8640d6338561\
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.8 (tags/v3.8.8:024d805, Feb 19 2021, 13:18:16) [MSC v.1928 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\User_01\AppData\Local\Temp\pip-install-trf2srgw\dlib_042210a71f3f4d22994c8640d6338561\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\User_01\AppData\Local\Temp\pip-install-trf2srgw\dlib_042210a71f3f4d22994c8640d6338561\build\lib.win-amd64-3.8 -DPYTHON_EXECUTABLE=c:\program files\python38\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\User_01\AppData\Local\Temp\pip-install-trf2srgw\dlib_042210a71f3f4d22994c8640d6338561\build\lib.win-amd64-3.8 -A x64'
-- Building for: NMake Makefiles
CMake Error at CMakeLists.txt:5 (message):
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
You must use Visual Studio to build a python extension on windows. If you
are getting this error it means you have not installed Visual C++. Note
that there are many flavors of Visual Studio, like Visual Studio for C#
development. You need to install Visual Studio for C++.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-- Configuring incomplete, errors occurred!
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\User_01\AppData\Local\Temp\pip-install-trf2srgw\dlib_042210a71f3f4d22994c8640d6338561\setup.py", line 223, in <module>
setup(
File "c:\program files\python38\lib\site-packages\setuptools\__init__.py", line 165, in setup
return distutils.core.setup(**attrs)
File "c:\program files\python38\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\program files\python38\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\program files\python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\User_01\AppData\Roaming\Python\Python38\site-packages\wheel\bdist_wheel.py", line 299, in run
self.run_command('build')
File "c:\program files\python38\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\program files\python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\program files\python38\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\program files\python38\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\program files\python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\User_01\AppData\Local\Temp\pip-install-trf2srgw\dlib_042210a71f3f4d22994c8640d6338561\setup.py", line 135, in run
self.build_extension(ext)
File "C:\Users\User_01\AppData\Local\Temp\pip-install-trf2srgw\dlib_042210a71f3f4d22994c8640d6338561\setup.py", line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\program files\python38\lib\subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\User_01\\AppData\\Local\\Temp\\pip-install-trf2srgw\\dlib_042210a71f3f4d22994c8640d6338561\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\User_01\\AppData\\Local\\Temp\\pip-install-trf2srgw\\dlib_042210a71f3f4d22994c8640d6338561\\build\\lib.win-amd64-3.8', '-DPYTHON_EXECUTABLE=c:\\program files\\python38\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\User_01\\AppData\\Local\\Temp\\pip-install-trf2srgw\\dlib_042210a71f3f4d22994c8640d6338561\\build\\lib.win-amd64-3.8', '-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:\program files\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\User_01\\AppData\\Local\\Temp\\pip-install-trf2srgw\\dlib_042210a71f3f4d22994c8640d6338561\\setup.py'"'"'; __file__='"'"'C:\\Users\\User_01\\AppData\\Local\\Temp\\pip-install-trf2srgw\\dlib_042210a71f3f4d22994c8640d6338561\\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\User_01\AppData\Local\Temp\pip-record-7k2ytc23\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\User_01\AppData\Roaming\Python\Python38\Include\dlib'
cwd: C:\Users\User_01\AppData\Local\Temp\pip-install-trf2srgw\dlib_042210a71f3f4d22994c8640d6338561\
I get this error when trying to install dlib with pip pip install dlib.
This error says
------------------------------------------------------------------------------
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++.
------------------------------------------------------------------------------
I found an answer Download and install visual studios c++ build tools and it will work.
Then run pip on console pip install dlib
download visual studio build tools - https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=16

python - VS code error in installing dlib/face_recognition

pip install dlib
Collecting dlib
Using cached dlib-19.21.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
I just simply wanted to download dlib after cmake.
I've downloaded cmake and tried dlib...
ERROR: Command errored out with exit status 1:
command: 'c:\users\user\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\USER\\AppData\\Local\\Temp\\pip-install-8yznfpzx\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\USER\\AppData\\Local\\Temp\\pip-install-8yznfpzx\\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\USER\AppData\Local\Temp\pip-record-avg12uez\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\user\appdata\local\programs\python\python38-32\Include\dlib'
cwd: C:\Users\USER\AppData\Local\Temp\pip-install-8yznfpzx\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\USER\AppData\Local\Temp\pip-install-8yznfpzx\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\USER\AppData\Local\Temp\pip-install-8yznfpzx\dlib\build\lib.win32-3.8 -DPYTHON_EXECUTABLE=c:\users\user\appdata\local\programs\python\python38-32\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\USER\AppData\Local\Temp\pip-install-8yznfpzx\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\USER\AppData\Local\Temp\pip-install-8yznfpzx\dlib\setup.py", line 223, in <module>
setup(
File "c:\users\user\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\__init__.py", line 144, in setup
return distutils.core.setup(**attrs)
File "c:\users\user\appdata\local\programs\python\python38-32\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\user\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\users\user\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\user\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\user\appdata\local\programs\python\python38-32\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "c:\users\user\appdata\local\programs\python\python38-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\user\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\user\appdata\local\programs\python\python38-32\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\user\appdata\local\programs\python\python38-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\user\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\USER\AppData\Local\Temp\pip-install-8yznfpzx\dlib\setup.py", line 135, in run
self.build_extension(ext)
File "C:\Users\USER\AppData\Local\Temp\pip-install-8yznfpzx\dlib\setup.py", line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\users\user\appdata\local\programs\python\python38-32\lib\subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\USER\\AppData\\Local\\Temp\\pip-install-8yznfpzx\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\USER\\AppData\\Local\\Temp\\pip-install-8yznfpzx\\dlib\\build\\lib.win32-3.8', '-DPYTHON_EXECUTABLE=c:\\users\\user\\appdata\\local\\programs\\python\\python38-32\\python.exe',
'-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\USER\\AppData\\Local\\Temp\\pip-install-8yznfpzx\\dlib\\build\\lib.win32-3.8']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\user\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\USER\\AppData\\Local\\Temp\\pip-install-8yznfpzx\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\USER\\AppData\\Local\\Temp\\pip-install-8yznfpzx\\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\USER\AppData\Local\Temp\pip-record-avg12uez\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\user\appdata\local\programs\python\python38-32\Include\dlib' Check the logs for full command output.
checked here a bit and saw a solution actually: https://stackoverflow.com/a/63648302/13692454
But here is new problem, I am using VS code and even if I download C++ extentions, it doesn't fix. I have no idea to what to do. How can i fix this? Thanks in advance*
Just used google colab to fix this problem. Can't find a solution for VS code...

Fail to install dlib on windows10

Following a YouTube video about face recognition, I installed Python 3.8.2, then CMAKE, and then dlib. The dlib failed with the following message. At first I had python 32 bits, then I removed it and installed the 64 bit version, with same problem. Any idea?
I did the same flow on a another computer, with a similar error, that was solved after installing CMake. In this case CMake is installed.
What did I miss?
C:\Users\NH5>pip install dlib
Defaulting to user installation because normal site-packages is not writeable
Collecting dlib
Using cached dlib-19.19.0.tar.gz (3.2 MB)
Could not build wheels 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:\program files\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\NH5\\AppData\\Local\\Temp\\pip-install-7c571567\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\NH5\\AppData\\Local\\Temp\\pip-install-7c571567\\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\NH5\AppData\Local\Temp\pip-record-wm_xgg14\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\NH5\AppData\Roaming\Python\Python38\Include\dlib'
cwd: C:\Users\NH5\AppData\Local\Temp\pip-install-7c571567\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.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\NH5\AppData\Local\Temp\pip-install-7c571567\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\NH5\AppData\Local\Temp\pip-install-7c571567\dlib\build\lib.win-amd64-3.8 -DPYTHON_EXECUTABLE=c:\program files\python38\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\NH5\AppData\Local\Temp\pip-install-7c571567\dlib\build\lib.win-amd64-3.8 -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/NH5/AppData/Local/Temp/pip-install-7c571567/dlib/build/temp.win-amd64-3.8/Release/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\NH5\AppData\Local\Temp\pip-install-7c571567\dlib\setup.py", line 223, in <module>
setup(
File "c:\program files\python38\lib\site-packages\setuptools\__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "c:\program files\python38\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\program files\python38\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\program files\python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\program files\python38\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "c:\program files\python38\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "c:\program files\python38\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\program files\python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\program files\python38\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\program files\python38\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\program files\python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\NH5\AppData\Local\Temp\pip-install-7c571567\dlib\setup.py", line 135, in run
self.build_extension(ext)
File "C:\Users\NH5\AppData\Local\Temp\pip-install-7c571567\dlib\setup.py", line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\program files\python38\lib\subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\NH5\\AppData\\Local\\Temp\\pip-install-7c571567\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\NH5\\AppData\\Local\\Temp\\pip-install-7c571567\\dlib\\build\\lib.win-amd64-3.8', '-DPYTHON_EXECUTABLE=c:\\program files\\python38\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\NH5\\AppData\\Local\\Temp\\pip-install-7c571567\\dlib\\build\\lib.win-amd64-3.8', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\program files\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\NH5\\AppData\\Local\\Temp\\pip-install-7c571567\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\NH5\\AppData\\Local\\Temp\\pip-install-7c571567\\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\NH5\AppData\Local\Temp\pip-record-wm_xgg14\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\NH5\AppData\Roaming\Python\Python38\Include\dlib' Check the logs for full command output.
C:\Users\NH5>
Try deepface. It is OS independent.
#!pip install deepface
from deepface import DeepFace
#face verification
obj = DeepFace.verify("img1.jpg", "img2.jpg")
#face recognition
df = DeepFace.find(img_path = "img1.jpg", db_path = "C:/workspace/my_db")
Find function looks for the identity of img1.jpg in my_db folder.

Installation of dlib with pip fails on Windows 10

I tried a lot to install pip install dlib but it always shows an error and I reinstalled cmake.
I got the error:
pip install dlib
Collecting dlib
Using cached https://files.pythonhosted.org/packages/1e/62/aacb236d21fbd08148b1d517d58a9d80ea31bdcd386d26f21f8b23b1eb28/dlib-19.18.0.tar.gz
Building wheels for collected packages: dlib
Building wheel for dlib (setup.py) ... 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\\hp\\AppData\\Local\\Temp\\pip-install-yynf7mue\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\hp\\AppData\\Local\\Temp\\pip-install-yynf7mue\\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\hp\AppData\Local\Temp\pip-wheel-0eyy_3vd' --python-tag cp37
cwd: C:\Users\hp\AppData\Local\Temp\pip-install-yynf7mue\dlib\
Complete output (55 lines):
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 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:\Users\hp\AppData\Local\Temp\pip-install-yynf7mue\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\hp\AppData\Local\Temp\pip-install-yynf7mue\dlib\build\lib.win-amd64-3.7 -DPYTHON_EXECUTABLE=c:\program files\python37\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\hp\AppData\Local\Temp\pip-install-yynf7mue\dlib\build\lib.win-amd64-3.7 -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/hp/AppData/Local/Temp/pip-install-yynf7mue/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\hp\AppData\Local\Temp\pip-install-yynf7mue\dlib\setup.py", line 261, in <module>
'Topic :: Software Development',
File "c:\program files\python37\lib\site-packages\setuptools\__init__.py", line 145, 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\wheel\bdist_wheel.py", line 192, 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\hp\AppData\Local\Temp\pip-install-yynf7mue\dlib\setup.py", line 135, in run
self.build_extension(ext)
File "C:\Users\hp\AppData\Local\Temp\pip-install-yynf7mue\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\\hp\\AppData\\Local\\Temp\\pip-install-yynf7mue\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\hp\\AppData\\Local\\Temp\\pip-install-yynf7mue\\dlib\\build\\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=c:\\program files\\python37\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\hp\\AppData\\Local\\Temp\\pip-install-yynf7mue\\dlib\\build\\lib.win-amd64-3.7', '-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:\program files\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\hp\\AppData\\Local\\Temp\\pip-install-yynf7mue\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\hp\\AppData\\Local\\Temp\\pip-install-yynf7mue\\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\hp\AppData\Local\Temp\pip-record-qzmuuf53\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\hp\AppData\Local\Temp\pip-install-yynf7mue\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.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\hp\AppData\Local\Temp\pip-install-yynf7mue\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\hp\AppData\Local\Temp\pip-install-yynf7mue\dlib\build\lib.win-amd64-3.7 -DPYTHON_EXECUTABLE=c:\program files\python37\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\hp\AppData\Local\Temp\pip-install-yynf7mue\dlib\build\lib.win-amd64-3.7 -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/hp/AppData/Local/Temp/pip-install-yynf7mue/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\hp\AppData\Local\Temp\pip-install-yynf7mue\dlib\setup.py", line 261, in <module>
'Topic :: Software Development',
File "c:\program files\python37\lib\site-packages\setuptools\__init__.py", line 145, 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\hp\AppData\Local\Temp\pip-install-yynf7mue\dlib\setup.py", line 135, in run
self.build_extension(ext)
File "C:\Users\hp\AppData\Local\Temp\pip-install-yynf7mue\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\\hp\\AppData\\Local\\Temp\\pip-install-yynf7mue\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\hp\\AppData\\Local\\Temp\\pip-install-yynf7mue\\dlib\\build\\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=c:\\program files\\python37\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\hp\\AppData\\Local\\Temp\\pip-install-yynf7mue\\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\\hp\\AppData\\Local\\Temp\\pip-install-yynf7mue\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\hp\\AppData\\Local\\Temp\\pip-install-yynf7mue\\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\hp\AppData\Local\Temp\pip-record-qzmuuf53\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
Do the following:
1.go to github repository of dlib package
2.click on the the green button which has written clone or download
3.Then click on Download Zip
4.after the download finished , extract the zip file and save it in desktop
NOTE: First intall CMake and then start following other steps.
5.go to dlib-master/dlib-master and copy the directory of dlib-master folder
which for you should be C:\Users\(you'r username)\Desktop\dlib-master\dlib-master, if you followed the steps.
6.Then open pwershell and type cd C:\Users\(you'r username)\Desktop\dlib-master\dlib-master
NOTE: IF you have not installed CMake properly , consider installing it , so that you can install the dlib module without any problem.
7.When you changed your current working directory by typing the above command, Then type python setup.py install
8.If you have installed cmake, then the package would install easily and flawlessly.
Answer Updated
further reading: How to manually install a pypi module without pip/easy_install?
Here I got the error that line
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
set CMake path into environment variable (As Shown in Figure)
Installing Visual Studio build tool latest version
link: https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017
after installing the Visual studio build tool select the package which needed and download it.
after download & installing successfully visual studio install dlib by commanding in CMD(ADMINISTRATOR) pip install dlib
I executed setup.py as #Moh Vahedi said and got following error in cmd:
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++.
So I'm installing VS now :)
This issue is also written here: Error in installing face_recognition module using pip

Error in installing face-recognition library

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

Categories

Resources