This is the error I have been facing while installing dlib. I have tried installing cmake first as I thought that was the issue. I installed cmake and it worked without any errors but I am not able to install dlib. Please check the code which I pasted below which was the error I have been facing
-- Configuring incomplete, errors occurred!
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\lenovo\AppData\Local\Temp\pip-install-zfdideoa\dlib_36bb0c7331c64241ba41d26308a57467\setup.py", line 222, in <module>
setup(
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
return run_commands(dist)
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
dist.run_commands()
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
self.run_command(cmd)
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\dist.py", line 1208, in run_command
super().run_command(command)
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
cmd_obj.run()
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\wheel\bdist_wheel.py", line 325, in run
self.run_command("build")
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\dist.py", line 1208, in run_command
super().run_command(command)
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
cmd_obj.run()
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\_distutils\command\build.py", line 132, in run
self.run_command(cmd_name)
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\dist.py", line 1208, in run_command
super().run_command(command)
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
cmd_obj.run()
File "C:\Users\lenovo\AppData\Local\Temp\pip-install-zfdideoa\dlib_36bb0c7331c64241ba41d26308a57467\setup.py", line 134, in run
self.build_extension(ext)
File "C:\Users\lenovo\AppData\Local\Temp\pip-install-zfdideoa\dlib_36bb0c7331c64241ba41d26308a57467\setup.py", line 171, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-install-zfdideoa\\dlib_36bb0c7331c64241ba41d26308a57467\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-install-zfdideoa\\dlib_36bb0c7331c64241ba41d26308a57467\\build\\lib.win-amd64-cpython-39', '-DPYTHON_EXECUTABLE=c:\\users\\lenovo\\appdata\\local\\programs\\python\\python39\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-install-zfdideoa\\dlib_36bb0c7331c64241ba41d26308a57467\\build\\lib.win-amd64-cpython-39', '-A', 'x64']' returned non-zero exit status 1.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for dlib
Running setup.py clean for dlib
Failed to build dlib
Installing collected packages: dlib
Running setup.py install for dlib ... error
error: subprocess-exited-with-error
× Running setup.py install for dlib did not run successfully.
│ exit code: 1
╰─> [72 lines of output]
running install
c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
running build_ext
C:\Users\lenovo\AppData\Local\Temp\pip-install-zfdideoa\dlib_36bb0c7331c64241ba41d26308a57467\setup.py:129: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
if LooseVersion(cmake_version) < '3.1.0':
Building extension for Python 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\lenovo\AppData\Local\Temp\pip-install-zfdideoa\dlib_36bb0c7331c64241ba41d26308a57467\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\lenovo\AppData\Local\Temp\pip-install-zfdideoa\dlib_36bb0c7331c64241ba41d26308a57467\build\lib.win-amd64-cpython-39 -DPYTHON_EXECUTABLE=c:\users\lenovo\appdata\local\programs\python\python39\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\lenovo\AppData\Local\Temp\pip-install-zfdideoa\dlib_36bb0c7331c64241ba41d26308a57467\build\lib.win-amd64-cpython-39 -A x64'
-- Building for: NMake Makefiles
CMake Error at CMakeLists.txt:5 (message):
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
You must use Visual Studio to build a python extension on windows. If you
are getting this error it means you have not installed Visual C++. Note
that there are many flavors of Visual Studio, like Visual Studio for C#
development. You need to install Visual Studio for C++.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-- Configuring incomplete, errors occurred!
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\lenovo\AppData\Local\Temp\pip-install-zfdideoa\dlib_36bb0c7331c64241ba41d26308a57467\setup.py", line 222, in <module>
setup(
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
return run_commands(dist)
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
dist.run_commands()
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
self.run_command(cmd)
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\dist.py", line 1208, in run_command
super().run_command(command)
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
cmd_obj.run()
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\command\install.py", line 68, in run
return orig.install.run(self)
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\_distutils\command\install.py", line 698, in run
self.run_command('build')
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\dist.py", line 1208, in run_command
super().run_command(command)
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
cmd_obj.run()
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\_distutils\command\build.py", line 132, in run
self.run_command(cmd_name)
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\dist.py", line 1208, in run_command
super().run_command(command)
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
cmd_obj.run()
File "C:\Users\lenovo\AppData\Local\Temp\pip-install-zfdideoa\dlib_36bb0c7331c64241ba41d26308a57467\setup.py", line 134, in run
self.build_extension(ext)
File "C:\Users\lenovo\AppData\Local\Temp\pip-install-zfdideoa\dlib_36bb0c7331c64241ba41d26308a57467\setup.py", line 171, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\users\lenovo\appdata\local\programs\python\python39\lib\subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-install-zfdideoa\\dlib_36bb0c7331c64241ba41d26308a57467\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-install-zfdideoa\\dlib_36bb0c7331c64241ba41d26308a57467\\build\\lib.win-amd64-cpython-39', '-DPYTHON_EXECUTABLE=c:\\users\\lenovo\\appdata\\local\\programs\\python\\python39\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-install-zfdideoa\\dlib_36bb0c7331c64241ba41d26308a57467\\build\\lib.win-amd64-cpython-39', '-A', 'x64']' returned non-zero exit status 1.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> dlib
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
I tried
pip install cmake
(This worked)
pip install dlib
(But this is not working)