I am using vs code in windows 10. When I install face_recognition in vs code using pip I got the following error, I have also tried to install dlib before installing face_recognition.
ERROR: Command errored out with exit status 1:
command: 'c:\users\admin\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-fi__6w9v\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-fi__6w9v\\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\Admin\AppData\Local\Temp\pip-record-f5b3pskr\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\admin\appdata\local\programs\python\python38\Include\dlib'
cwd: C:\Users\Admin\AppData\Local\Temp\pip-install-fi__6w9v\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:57:54) [MSC v.1924 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\Admin\AppData\Local\Temp\pip-install-fi__6w9v\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Admin\AppData\Local\Temp\pip-install-fi__6w9v\dlib\build\lib.win-amd64-3.8 -DPYTHON_EXECUTABLE=c:\users\admin\appdata\local\programs\python\python38\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Admin\AppData\Local\Temp\pip-install-fi__6w9v\dlib\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\Admin\AppData\Local\Temp\pip-install-fi__6w9v\dlib\setup.py", line 223, in <module>
setup(
File "c:\users\admin\appdata\local\programs\python\python38\lib\site-packages\setuptools\__init__.py", line 144, in setup
return distutils.core.setup(**attrs)
File "c:\users\admin\appdata\local\programs\python\python38\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\admin\appdata\local\programs\python\python38\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\users\admin\appdata\local\programs\python\python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\admin\appdata\local\programs\python\python38\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "c:\users\admin\appdata\local\programs\python\python38\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "c:\users\admin\appdata\local\programs\python\python38\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\admin\appdata\local\programs\python\python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\admin\appdata\local\programs\python\python38\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\admin\appdata\local\programs\python\python38\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\admin\appdata\local\programs\python\python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\Admin\AppData\Local\Temp\pip-install-fi__6w9v\dlib\setup.py", line 135, in run
self.build_extension(ext)
File "C:\Users\Admin\AppData\Local\Temp\pip-install-fi__6w9v\dlib\setup.py", line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\users\admin\appdata\local\programs\python\python38\lib\subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-fi__6w9v\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-fi__6w9v\\dlib\\build\\lib.win-amd64-3.8', '-DPYTHON_EXECUTABLE=c:\\users\\admin\\appdata\\local\\programs\\python\\python38\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-fi__6w9v\\dlib\\build\\lib.win-amd64-3.8', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\admin\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-fi__6w9v\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-fi__6w9v\\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\Admin\AppData\Local\Temp\pip-record-f5b3pskr\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\admin\appdata\local\programs\python\python38\Include\dlib' Check the logs for full command output.
The answer is really simple. You have to do what it says. Go to the VS installer and install VS for C++ and C#. The reason is that these modules use C code and while using Visual Studio, you have to make it so that it can compile the C++ code
For those who don't want to install the entirety of Visual Studio there is an easier way to get the required CMake tools:
Step 1: Download and run Build Tools for Visual Studio 2022 https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019
Step 2: Go to Individual Components and select C++ CMake tools for Windows and run through the install.
Step 3: Proceed to build your python application (e.g. dlib)
Related
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
when I install dlib this error occurs. I have Microsoft visual c++ 15 installed and I use python 3.7
how to solve this problem
ERROR: Command errored out with exit status 1:
command: 'c:\users\arun\appdata\local\programs\python\python37\python.exe' -u -c 'import
sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Arun\AppData\Local\Temp\pip-ins
tall-lmmcwnu_\dlib_2eee917da90a4678b1df02cb4f909e4b\setup.py'"'"'; file='"'"'C:\Users\
\Arun\AppData\Local\Temp\pip-install-lmmcwnu_\dlib_2eee917da90a4678b1df02cb4f909e4b\set
up.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\
n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --reco
rd 'C:\Users\Arun\AppData\Local\Temp\pip-record-prlmpx1h\install-record.txt' --single-version
-externally-managed --compile --install-headers 'c:\users\arun\appdata\local\programs\python\
python37\Include\dlib'
cwd: C:\Users\Arun\AppData\Local\Temp\pip-install-lmmcwnu_\dlib_2eee917da90a4678b1df
02cb4f909e4b\
Complete output (57 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.7.7 (tags/v3.7.7:d7c567b08f, Mar 10 2020, 10:41:24) [MSC
v.1900 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\Arun\AppData\Local\Temp\pip-install-lmmcwnu_\dlib_2
eee917da90a4678b1df02cb4f909e4b\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Arun\A
ppData\Local\Temp\pip-install-lmmcwnu_\dlib_2eee917da90a4678b1df02cb4f909e4b\build\lib.win-am
d64-3.7 -DPYTHON_EXECUTABLE=c:\users\arun\appdata\local\programs\python\python37\python.exe -
DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Arun\AppData\Local\Temp\pip-install-lmmcwnu_
\dlib_2eee917da90a4678b1df02cb4f909e4b\build\lib.win-amd64-3.7 -A x64'
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version to target Windows 6.3.9600.
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:14 (project):
No CMAKE_C_COMPILER could be found.
CMake Error at CMakeLists.txt:14 (project):
No CMAKE_CXX_COMPILER could be found.
-- Configuring incomplete, errors occurred!
See also "C:/Users/Arun/AppData/Local/Temp/pip-install-lmmcwnu_/dlib_2eee917da90a4678b1df
02cb4f909e4b/build/temp.win-amd64-3.7/Release/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Arun/AppData/Local/Temp/pip-install-lmmcwnu_/dlib_2eee917da90a4678b1df
02cb4f909e4b/build/temp.win-amd64-3.7/Release/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\Arun\AppData\Local\Temp\pip-install-lmmcwnu_\dlib_2eee917da90a4678b1df02
cb4f909e4b\setup.py", line 262, in
'Topic :: Software Development',
File "c:\users\arun\appdata\local\programs\python\python37\lib\site-packages\setuptools
_init_.py", line 145, in setup
return distutils.core.setup(**attrs)
File "c:\users\arun\appdata\local\programs\python\python37\lib\distutils\core.py", line
148, in setup
dist.run_commands()
File "c:\users\arun\appdata\local\programs\python\python37\lib\distutils\dist.py", line
966, in run_commands
self.run_command(cmd)
File "c:\users\arun\appdata\local\programs\python\python37\lib\distutils\dist.py", line 985, in run_command cmd_obj.run()
File "c:\users\arun\appdata\local\programs\python\python37\lib\site-packages\setuptools\command\install.py", line 61, in run return orig.install.run(self)
File "c:\users\arun\appdata\local\programs\python\python37\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "c:\users\arun\appdata\local\programs\python\python37\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\arun\appdata\local\programs\python\python37\lib\distutils\dist.py", line 985, in run_command cmd_obj.run()
File "c:\users\arun\appdata\local\programs\python\python37\lib\distutils\command\build.py", line 135, in run self.run_command(cmd_name)
File "c:\users\arun\appdata\local\programs\python\python37\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command)
File "c:\users\arun\appdata\local\programs\python\python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\Arun\AppData\Local\Temp\pip-install-lmmcwnu_\dlib_2eee917da90a4678b1df02cb4f909e4b\setup.py", line 135, in run self.build_extension(ext)
File "C:\Users\Arun\AppData\Local\Temp\pip-install-lmmcwnu_\dlib_2eee917da90a4678b1df02cb4f909e4b\setup.py", line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\users\arun\appdata\local\programs\python\python37\lib\subprocess.py", line 363, in check_call raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\Users\Arun\AppData\Local\Temp\pip-install-lmmcwnu_\dlib_2eee917da90a4678b1df02cb4f909e4b\tools\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Arun\AppData\Local\Temp\pip-install-lmmcwnu_\dlib_2eee917da90a4678b1df02cb4f909e4b\build\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=c:\users\arun\appdata\local\programs\python\python37\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Arun\AppData\Local\Temp\pip-install-lmmcwnu_\dlib_2eee917da90a4678b1df02c
b4f909e4b\build\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.
ERROR: Command errored out with exit status 1: 'c:\users\arun\appdata\local\programs\python\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Arun\AppData\Local\Temp\pip-install-lmmcwnu_\dlib_2eee917da90a4678b1df02cb4f909e4b\setup.py'"'"'; file='"'"'C:\Users\Arun\AppData\Local\Temp\pip-install-lmmcwnu_\dlib_2eee917da90a4678b1df02cb4f909e4b\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\Arun\AppData\Local\Temp\pip-record-prlmpx1h\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\arun\appdata\local\programs\python\python37\Include\dlib' Check the logs for full command output.
The issue is that you're missing a usable compiler toolchain. First get Cmake and set that up, then give it another shot.
I'm trying to install dlib on vertual studio code but the following error is displayed:
Running setup.py install for dlib ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\acer\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ACER\\AppData\\Local\\Temp\\pip-install-iotpp637\\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\\setup.py'"'"'; __file__='"'"'C:\\Users\\ACER\\AppData\\Local\\Temp\\pip-install-iotpp637\\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\\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\ACER\AppData\Local\Temp\pip-record-qzdzy48q\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\acer\appdata\local\programs\python\python39\Include\dlib'
cwd: C:\Users\ACER\AppData\Local\Temp\pip-install-iotpp637\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\
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.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\ACER\AppData\Local\Temp\pip-install-iotpp637\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\ACER\AppData\Local\Temp\pip-install-iotpp637\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\build\lib.win-amd64-3.9 -DPYTHON_EXECUTABLE=c:\users\acer\appdata\local\programs\python\python39\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\ACER\AppData\Local\Temp\pip-install-iotpp637\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\build\lib.win-amd64-3.9 -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\ACER\AppData\Local\Temp\pip-install-iotpp637\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\setup.py", line 223, in <module>
setup(
File "c:\users\acer\appdata\local\programs\python\python39\lib\site-packages\setuptools\__init__.py", line 165, in setup
return distutils.core.setup(**attrs)
File "c:\users\acer\appdata\local\programs\python\python39\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\acer\appdata\local\programs\python\python39\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\users\acer\appdata\local\programs\python\python39\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\acer\appdata\local\programs\python\python39\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "c:\users\acer\appdata\local\programs\python\python39\lib\distutils\command\install.py", line 546, in run
self.run_command('build')
File "c:\users\acer\appdata\local\programs\python\python39\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\acer\appdata\local\programs\python\python39\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\acer\appdata\local\programs\python\python39\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\acer\appdata\local\programs\python\python39\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\acer\appdata\local\programs\python\python39\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\ACER\AppData\Local\Temp\pip-install-iotpp637\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\setup.py", line 135, in run
self.build_extension(ext)
File "C:\Users\ACER\AppData\Local\Temp\pip-install-iotpp637\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\setup.py", line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\users\acer\appdata\local\programs\python\python39\lib\subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\ACER\\AppData\\Local\\Temp\\pip-install-iotpp637\\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\ACER\\AppData\\Local\\Temp\\pip-install-iotpp637\\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\\build\\lib.win-amd64-3.9', '-DPYTHON_EXECUTABLE=c:\\users\\acer\\appdata\\local\\programs\\python\\python39\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\ACER\\AppData\\Local\\Temp\\pip-install-iotpp637\\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\\build\\lib.win-amd64-3.9', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\acer\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ACER\\AppData\\Local\\Temp\\pip-install-iotpp637\\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\\setup.py'"'"'; __file__='"'"'C:\\Users\\ACER\\AppData\\Local\\Temp\\pip-install-iotpp637\\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\\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\ACER\AppData\Local\Temp\pip-record-qzdzy48q\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\acer\appdata\local\programs\python\python39\Include\dlib' Check the logs for full command output.
Additional note: I installed cmake and tried again but nothing change.
The error is obvious from the error message you got:
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++.
You need to install *Visual Studio for C++ from here and rerun the installation so that the C++ extension to Python can get built.
You can avoid that using Anaconda where the dlib package is available already compiled (but for the moment not for Python 3.9).
you can use the following method to avoid installing the "Huge" IDE (VS) or the Anaconda.
Many binaries depend on Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019 for Python 3
so, please try to use the following codes to solve it
pip install --upgrade setuptools
if you are not succeed to solve this problem,
then you can try to use this link The latest supported Visual C++ downloads to install this problem
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...
I try to install onnx in cmd using the command pip install onnx, but I receive an error which says that I have a problem in cmake.
The error output is:
ERROR: Command errored out with exit status 1:
>>command: 'c:\users\realm\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\realm\\AppData\\Local\\Temp\\pip-install-oxwi8385\\onnx\\setup.py'"'"'; __file__='"'"'C:\\Users\\realm\\AppData\\Local\\Temp\\pip-install-oxwi8385\\onnx\\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\realm\AppData\Local\Temp\pip-record-h01e7u49\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\realm\appdata\local\programs\python\python38-32\Include\onnx'
cwd: C:\Users\realm\AppData\Local\Temp\pip-install-oxwi8385\onnx\
Complete output (82 lines):
running install
running build
running build_py
running create_version
running cmake_build
-- Building for: NMake Makefiles
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:17 (project):
The CMAKE_C_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
CMake Error at CMakeLists.txt:17 (project):
The CMAKE_CXX_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
>
-- Configuring incomplete, errors occurred!
See also "C:/Users/realm/AppData/Local/Temp/pip-install-oxwi8385/onnx/.setuptools-cmake-build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/realm/AppData/Local/Temp/pip-install-oxwi8385/onnx/.setuptools-cmake-build/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\realm\AppData\Local\Temp\pip-install-oxwi8385\onnx\setup.py", line 315, in <module>
setuptools.setup(
File "c:\users\realm\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\realm\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\realm\appdata\local\programs\python\python38-32\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\realm\AppData\Local\Temp\pip-install-oxwi8385\onnx\setup.py", line 209, in run
self.run_command('cmake_build')
File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\realm\AppData\Local\Temp\pip-install-oxwi8385\onnx\setup.py", line 195, in run
subprocess.check_call(cmake_args)
File "c:\users\realm\appdata\local\programs\python\python38-32\lib\subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['C:\\Users\\realm\\AppData\\Local\\Programs\\Python\\Python38-32\\Scripts\\cmake.exe', '-DPYTHON_INCLUDE_DIR=c:\\users\\realm\\appdata\\local\\programs\\python\\python38-32\\include', '-DPYTHON_EXECUTABLE=c:\\users\\realm\\appdata\\local\\programs\\python\\python38-32\\python.exe', '-DBUILD_ONNX_PYTHON=ON', '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON', '-DONNX_NAMESPACE=onnx', '-DPY_EXT_SUFFIX=.cp38-win32.pyd', '-DCMAKE_BUILD_TYPE=Release', '-DPY_VERSION=3.8', '-DONNX_USE_MSVC_STATIC_RUNTIME=ON', '-DONNX_ML=1', 'C:\\Users\\realm\\AppData\\Local\\Temp\\pip-install-oxwi8385\\onnx']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1:
>>'c:\users\realm\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\realm\\AppData\\Local\\Temp\\pip-install-oxwi8385\\onnx\\setup.py'"'"'; __file__='"'"'C:\\Users\\realm\\AppData\\Local\\Temp\\pip-install-oxwi8385\\onnx\\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\realm\AppData\Local\Temp\pip-record-h01e7u49\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\realm\appdata\local\programs\python\python38-32\Include\onnx' Check the logs for full command output.
I found the solution, the cause was the version of python that I use version 3.8 but when I changed the version to 3.7 it worked I don't know exactly why I found that onnx did not have 3.8 wheel that's why it is not supported by version 3.8