Issue
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++.
------------------------------------------------------------------------------
Solution
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
Answered By - Sumeth Sathnindu
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.