getting Error in installing Dlib using pip - python

C:\Users\suraj>pip install dlib
Collecting dlib
Using cached https://files.pythonhosted.org/packages/35/8d/e4ddf60452e2fb1ce3164f774e68968b3f110f1cb4cd353235d56875799e/dlib-19.16.0.tar.gz
Building wheels for collected packages: dlib
Running setup.py bdist_wheel for dlib ... error
Complete output from command c:\users\suraj\appdata\local\programs\python\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\suraj\\AppData\\Local\\Temp\\pip-install-ytzp5t26\\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\suraj\AppData\Local\Temp\pip-wheel-mu6pctca --python-tag cp37:
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.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\suraj\AppData\Local\Temp\pip-install-ytzp5t26\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\suraj\AppData\Local\Temp\pip-install-ytzp5t26\dlib\build\lib.win-amd64-3.7 -DPYTHON_EXECUTABLE=c:\users\suraj\appdata\local\programs\python\python37\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\suraj\AppData\Local\Temp\pip-install-ytzp5t26\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/suraj/AppData/Local/Temp/pip-install-ytzp5t26/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\suraj\AppData\Local\Temp\pip-install-ytzp5t26\dlib\setup.py", line 257, in <module>
'Topic :: Software Development',
File "c:\users\suraj\appdata\local\programs\python\python37\lib\site-packages\setuptools\__init__.py", line 143, in setup
return distutils.core.setup(**attrs)
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\suraj\appdata\local\programs\python\python37\lib\site-packages\wheel\bdist_wheel.py", line 188, in run
self.run_command('build')
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\suraj\AppData\Local\Temp\pip-install-ytzp5t26\dlib\setup.py", line 133, in run
self.build_extension(ext)
File "C:\Users\suraj\AppData\Local\Temp\pip-install-ytzp5t26\dlib\setup.py", line 170, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\users\suraj\appdata\local\programs\python\python37\lib\subprocess.py", line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\suraj\\AppData\\Local\\Temp\\pip-install-ytzp5t26\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\suraj\\AppData\\Local\\Temp\\pip-install-ytzp5t26\\dlib\\build\\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=c:\\users\\suraj\\appdata\\local\\programs\\python\\python37\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\suraj\\AppData\\Local\\Temp\\pip-install-ytzp5t26\\dlib\\build\\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
**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
Complete output from command c:\users\suraj\appdata\local\programs\python\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\suraj\\AppData\\Local\\Temp\\pip-install-ytzp5t26\\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\suraj\AppData\Local\Temp\pip-record-adx5_t4v\install-record.txt --single-version-externally-managed --compile:
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\suraj\AppData\Local\Temp\pip-install-ytzp5t26\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\suraj\AppData\Local\Temp\pip-install-ytzp5t26\dlib\build\lib.win-amd64-3.7 -DPYTHON_EXECUTABLE=c:\users\suraj\appdata\local\programs\python\python37\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\suraj\AppData\Local\Temp\pip-install-ytzp5t26\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/suraj/AppData/Local/Temp/pip-install-ytzp5t26/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\suraj\AppData\Local\Temp\pip-install-ytzp5t26\dlib\setup.py", line 257, in <module>
'Topic :: Software Development',
File "c:\users\suraj\appdata\local\programs\python\python37\lib\site-packages\setuptools\__init__.py", line 143, in setup
return distutils.core.setup(**attrs)
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\suraj\appdata\local\programs\python\python37\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\suraj\AppData\Local\Temp\pip-install-ytzp5t26\dlib\setup.py", line 133, in run
self.build_extension(ext)
File "C:\Users\suraj\AppData\Local\Temp\pip-install-ytzp5t26\dlib\setup.py", line 170, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\users\suraj\appdata\local\programs\python\python37\lib\subprocess.py", line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\suraj\\AppData\\Local\\Temp\\pip-install-ytzp5t26\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\suraj\\AppData\\Local\\Temp\\pip-install-ytzp5t26\\dlib\\build\\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=c:\\users\\suraj\\appdata\\local\\programs\\python\\python37\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\suraj\\AppData\\Local\\Temp\\pip-install-ytzp5t26\\dlib\\build\\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
Command "c:\users\suraj\appdata\local\programs\python\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\suraj\\AppData\\Local\\Temp\\pip-install-ytzp5t26\\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\suraj\AppData\Local\Temp\pip-record-adx5_t4v\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\suraj\AppData\Local\Temp\pip-install-ytzp5t26\dlib\
This is the Error I'm getting while installing dlib using pip in command prompt.
I already have openCV and matplotlib and numpy.

I faced the same problem a while back. I did a few things and it worked
Install C and C++ compilers and add them to path.
Install visual studio 2015 (VS2015) down-loader. (any other version might not work). This stack overflow thread may help: How to download Visual Studio Community Edition 2015 (not 2017)
Install all the dependencies through VS2015.(support for C, C++, MS Build, windows SDK etc)
Try and use pip install dlib again.
I hope this helps!

For those who are facing the same problem but using mac OS --> I did the below steps and resolved the same issue. I have macOS Big Sur 11.1 with python 3.8.3.
pip3 install cmake
pip3 install dlib

OK for the record here: On debian 10. pip install dlib fails even with pip install cmake first. Solution? sudo apt install libopenblas-dev. The output of pip install dlib --verbose mentions it as an optional install that makes your code run faster. Turns out without installing this first the install fails every time. With it the install succeeds.

download cmake executable file on your pc, install it and install cmake build tools for c++ from visual studio build tools. After installing cmake with visual studio build tools, you can download the wheel file from this github repo: https://github.com/Tobyyosoba777/Computer-Vision-OpenCv-Python-/tree/main/Libraries
download: dlib-19.22.99-cp39-cp39-win_amd64.whl
and download: dlib-19.22.99.win-amd64-py3.9.exe
install the .exe file on your pc, restart it(not necessary) and open the current directory of the downloaded .whl file where it is saved on your pc in your python/anaconda terminal/ cmd
for example:
C:\Users\USER->cd desktop "if you downloaded the file to your desktop" this command will move you to the current directory of the .whl file
then input: "pip install dlib-19.22.99-cp39-cp39-win_amd64.whl"
that should work...hopefully

You may need to install cmake first: "pip install cmake"
Then install dlib i.e: "pip install dlib".
Will surely work 100%.
Note: You must have a fast processor for building wheel else it'll take more than 5mins.

I faced many error while installing dlib and solve by using below .whl:
pip install https://pypi.python.org/packages/da/06/bd3e241c4eb0a662914b3b4875fc52dd176a9db0d4a2c915ac2ad8800e9e/dlib-19.7.0-cp36-cp36m-win_amd64.whl#md5=b7330a5b2d46420343fbed5df69e6a3f
Download wheel from this link
This might help :)

Related

Need to install dlib package in windows 7

I tried to install dlib package in windows 7 using the below commands,
pip install dlib==19.18.0
and
python -m pip install https://files.pythonhosted.org/packages/1e/62/aacb236d21fbd08148b1d517d58a9d80ea31bdcd386d26f21f8b23b1eb28/dlib-19.18.0.tar.gz#sha256=8ca127253a0ca82a3d847148515f82ff2c504ed77a6385ec4f38c7f8e5360860
Download tar file and run python setup.py install.
I am getting the below error:
Collecting dlib==19.18.0
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:\users\admin\envs\api\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-hwgs8hc1\\dlib\\setu
p.py'"'"'; __file__='"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-hwgs8hc1\\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\Admin\AppData\Local\Temp\pip-wheel-5sltbyhe' --python-tag cp36
cwd: C:\Users\Admin\AppData\Local\Temp\pip-install-hwgs8hc1\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.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\Admin\AppData\Local\Temp\pip-install-hwgs8hc1\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Admin\AppData\Local\Temp\pip-install-hwgs8h
c1\dlib\build\lib.win-amd64-3.6 -DPYTHON_EXECUTABLE=c:\users\admin\envs\api\scripts\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Admin\AppData\Local\Temp\pip-install-hwgs8hc
1\dlib\build\lib.win-amd64-3.6 -A x64'
-- Building for: NMake Makefiles
CMake Error at CMakeLists.txt:3 (project):
Generator
NMake Makefiles
does not support platform specification, but platform
x64
was specified.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "C:/Users/Admin/AppData/Local/Temp/pip-install-hwgs8hc1/dlib/build/temp.win-amd64-3.6/Release/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Admin\AppData\Local\Temp\pip-install-hwgs8hc1\dlib\setup.py", line 261, in <module>
'Topic :: Software Development',
File "c:\users\admin\envs\api\lib\site-packages\setuptools\__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "c:\users\admin\appdata\local\programs\python\python36\Lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\admin\appdata\local\programs\python\python36\Lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "c:\users\admin\appdata\local\programs\python\python36\Lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\users\admin\envs\api\lib\site-packages\wheel\bdist_wheel.py", line 192, in run
self.run_command('build')
File "c:\users\admin\appdata\local\programs\python\python36\Lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\admin\appdata\local\programs\python\python36\Lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\users\admin\appdata\local\programs\python\python36\Lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\admin\appdata\local\programs\python\python36\Lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\admin\appdata\local\programs\python\python36\Lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\Admin\AppData\Local\Temp\pip-install-hwgs8hc1\dlib\setup.py", line 135, in run
self.build_extension(ext)
File "C:\Users\Admin\AppData\Local\Temp\pip-install-hwgs8hc1\dlib\setup.py", line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\users\admin\appdata\local\programs\python\python36\Lib\subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-hwgs8hc1\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\Admin\\
AppData\\Local\\Temp\\pip-install-hwgs8hc1\\dlib\\build\\lib.win-amd64-3.6', '-DPYTHON_EXECUTABLE=c:\\users\\admin\\envs\\api\\scripts\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEAS
E=C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-hwgs8hc1\\dlib\\build\\lib.win-amd64-3.6', '-A', 'x64']' returned non-zero exit status 1.
ERROR: Command errored out with exit status 1: 'c:\users\admin\envs\api\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Admin\\AppData\\Local\\Tem
p\\pip-install-hwgs8hc1\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-hwgs8hc1\\dlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__fil
e__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Admin\AppData\Local\Temp\pip-record-3bbuo3ir\ins
tall-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\admin\envs\api\include\site\python3.6\dlib' Check the logs for full command output.
I need to install dlib version==19.18.0 or 19.19.0.
I am using python 3.6.5 and pycharm. I need to install dlib without using anaconda.
Please help me with this...
Try this method :
Via Anaconda we can install the dlib.
Install the anaconda exe file from this link
(https://www.anaconda.com/distribution/#download-section)
In Conda prompt, create an environment using this command
**conda create --name env_name python=3.7.0**
Then activate the env
**conda activate env_nam**e
Install dlib
**conda install -c conda-forge dlib=19.17**

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

I'm not able to install dlib using pip command and manually both ways

I have been trying to download dlib on my system from past one week and I am not able to download it using pip or the manual process I also have looked on several questions asked here and checked the required processes like.
but still, I was unsuccessful ... I need to learn about opencv and dlib so please help me anyone ... and my device properties which I think might not be the problem.
Installed C and C++ compilers and add them to a path.
Installed visual studio 2015 (VS2015) down-loader and 2017 both
Installed all the dependencies through VS2015.(support for C, C++, MS Build, Windows SDK, etc)
C:\Users\Akshay>pip install dlib
Collecting dlib
Using cached https://files.pythonhosted.org/packages/05/57/e8a8caa3c89a27f80bc
78da39c423e2553f482a3705adc619176a3a24b36/dlib-19.17.0.tar.gz
Installing collected packages: dlib
Running setup.py install for dlib ... error
ERROR: Complete output from command 'c:\users\akshay\appdata\local\programs\
python\python37\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\
\Users\\Akshay\\AppData\\Local\\Temp\\pip-install-8qdv7218\\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\Akshay\AppData\Local\Temp\pip-record-dupqe8e6\instal
l-record.txt' --single-version-externally-managed --compile:
ERROR: 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.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:0
5) [MSC v.1916 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\Akshay\AppData\Local\Temp\pip-install-
8qdv7218\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Akshay\AppD
ata\Local\Temp\pip-install-8qdv7218\dlib\build\lib.win-amd64-3.7 -DPYTHON_EXECUT
ABLE=c:\users\akshay\appdata\local\programs\python\python37\python.exe -DCMAKE_L
IBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Akshay\AppData\Local\Temp\pip-install-8
qdv7218\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/Akshay/AppData/Local/Temp/pip-install-8qdv7218/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\Akshay\AppData\Local\Temp\pip-install-8qdv7218\dlib\setup.p
y", line 261, in <module>
'Topic :: Software Development',
File "c:\users\akshay\appdata\local\programs\python\python37\lib\site-pack
ages\setuptools\__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "c:\users\akshay\appdata\local\programs\python\python37\lib\distutils
\core.py", line 148, in setup
dist.run_commands()
File "c:\users\akshay\appdata\local\programs\python\python37\lib\distutils
\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\users\akshay\appdata\local\programs\python\python37\lib\distutils
\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\akshay\appdata\local\programs\python\python37\lib\site-pack
ages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "c:\users\akshay\appdata\local\programs\python\python37\lib\distutils
\command\install.py", line 545, in run
self.run_command('build')
File "c:\users\akshay\appdata\local\programs\python\python37\lib\distutils
\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\akshay\appdata\local\programs\python\python37\lib\distutils
\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\akshay\appdata\local\programs\python\python37\lib\distutils
\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\akshay\appdata\local\programs\python\python37\lib\distutils
\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\akshay\appdata\local\programs\python\python37\lib\distutils
\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\Akshay\AppData\Local\Temp\pip-install-8qdv7218\dlib\setup.p
y", line 135, in run
self.build_extension(ext)
File "C:\Users\Akshay\AppData\Local\Temp\pip-install-8qdv7218\dlib\setup.p
y", line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\users\akshay\appdata\local\programs\python\python37\lib\subproces
s.py", line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\Akshay\\AppDat
a\\Local\\Temp\\pip-install-8qdv7218\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUT
PUT_DIRECTORY=C:\\Users\\Akshay\\AppData\\Local\\Temp\\pip-install-8qdv7218\\dli
b\\build\\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=c:\\users\\akshay\\appdata\\l
ocal\\programs\\python\\python37\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY
_RELEASE=C:\\Users\\Akshay\\AppData\\Local\\Temp\\pip-install-8qdv7218\\dlib\\bu
ild\\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command "'c:\users\akshay\appdata\local\programs\python\python37\python.e
xe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\Akshay\\AppData\
\Local\\Temp\\pip-install-8qdv7218\\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:\Us
ers\Akshay\AppData\Local\Temp\pip-record-dupqe8e6\install-record.txt' --single-v
ersion-externally-managed --compile" failed with error code 1 in C:\Users\Akshay
\AppData\Local\Temp\pip-install-8qdv7218\dlib\

Error during installation of Dlib library on Windows 10 computer

i have a problem about building dlib library on my computer which has windows 10 OS.
Here is my python version :
C:\Windows\system32>python --version
Python 3.7.0
Here is my pip version :
C:\Windows\system32>pip --version
pip 10.0.1 from C:\ProgramData\Anaconda3\lib\site-packages\pip (python 3.7)
I am trying to download and build the dlib as below :
pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org --user dlib
The problem starts when pip finished the downloading. After the downloading completes, I get an error message as below which makes me cannot understand what is the actual problem.
NOTE 1 : I already downloaded Anaconda but it also did not solve my problem.
NOTE 2 : As an advice from some Github pages, i also tried the following command but it gave the same error, unfortunately.
pip install --trusted-host pypi.python.org --trusted-host >files.pythonhosted.org --trusted-host pypi.org --user --no-cache-dir >face_recognition
Downloading https://files.pythonhosted.org/packages/35/8d/e4ddf60452e2fb1ce3164f774e68968b3f110f1cb4cd353235d56875799e/dlib-19.16.0.tar.gz (3.3MB)
100% |████████████████████████████████| 3.3MB 159kB/s
Building wheels for collected packages: dlib
Running setup.py bdist_wheel for dlib ... error
Complete output from command C:\ProgramData\Anaconda3\python.exe -u -c "import setuptools, tokenize;file='C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\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\arslanom\AppData\Local\Temp\pip-wheel-4nl02lnx --python-tag cp37:
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.0 (default, Jun 28 2018, 08:04:48) [MSC v.1912 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\build\lib.win-amd64-3.7 -DPYTHON_EXECUTABLE=C:\ProgramData\Anaconda3\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\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/arslanom/AppData/Local/Temp/pip-install-2r99u3rh/dlib/build/temp.win-amd64-3.7/Release/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\setup.py", line 257, in
'Topic :: Software Development',
File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools__init__.py", line 140, in setup
return distutils.core.setup(**attrs)
File "C:\ProgramData\Anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\ProgramData\Anaconda3\lib\site-packages\wheel\bdist_wheel.py", line 202, in run
self.run_command('build')
File "C:\ProgramData\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\ProgramData\Anaconda3\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\ProgramData\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\setup.py", line 133, in run
self.build_extension(ext)
File "C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\setup.py", line 170, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 328, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\tools\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\build\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=C:\ProgramData\Anaconda3\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\build\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.
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
Complete output from command C:\ProgramData\Anaconda3\python.exe -u -c "import setuptools, tokenize;file='C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\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\arslanom\AppData\Local\Temp\pip-record-5t8l4109\install-record.txt --single-version-externally-managed --compile --user --prefix=:
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.0 (default, Jun 28 2018, 08:04:48) [MSC v.1912 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\build\lib.win-amd64-3.7 -DPYTHON_EXECUTABLE=C:\ProgramData\Anaconda3\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\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/arslanom/AppData/Local/Temp/pip-install-2r99u3rh/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\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\setup.py", line 257, in <module>
'Topic :: Software Development',
File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools\__init__.py", line 140, in setup
return distutils.core.setup(**attrs)
File "C:\ProgramData\Anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "C:\ProgramData\Anaconda3\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "C:\ProgramData\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\ProgramData\Anaconda3\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\ProgramData\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\setup.py", line 133, in run
self.build_extension(ext)
File "C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\setup.py", line 170, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 328, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\arslanom\\AppData\\Local\\Temp\\pip-install-2r99u3rh\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\arslanom\\AppData\\Local\\Temp\\pip-install-2r99u3rh\\dlib\\build\\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=C:\\ProgramData\\Anaconda3\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\arslanom\\AppData\\Local\\Temp\\pip-install-2r99u3rh\\dlib\\build\\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.
Failed building wheels means that, naively dlib is constructed on c++. Soo for it to be converted to python you'll need Microsoft visual studio c++ package to build the wheel files
Below steps I used to install Dlib on Windows:
Pre-Requisite:
1) Install Python 3.6 64-bit. If you have Python 32-bit, you need to install Python 3.6 64-bit. Please note, you can not have both Python versions running at same time. If you are intended to run Python 3.6 64-bit, then you need keep Python 3.6 library paths at first position in System and User environment paths.
Visit this tutorial for more info on switching between python versions: Tutorial on switching between Python Versions
2) Install cmake library:
Click link – Cmake Installer and install Cmake. Otherwise, open CMD: install cmake library using pip: pip install cmake
Give path of cmake library in System Environment Path and User Path.
e.g. C:\Program Files\CMake\bin
In your case it could be different.
3) Install Visual Studio C++ Build Tools:
Follow this tutorial to install C++ build tools: Tutorial to install C++ Build Tools
It is essential to install C++ compiler to install dlib library
4) Install Numpy library: pip install numpy
After successful installation of above libraries/tools, open CMD with “Run as Administrator”. Then give command “pip install dlib”
It will install dlib library and it will take time to install. If you have some previous versions of dlib then uninstall them first.
Be patient as it takes lot of time to install this library and also many other ML libraries.
I successfully installed dlib 19.8.1 on Python 3.7 for windows 64bit using
https://www.file-upload.com/qsd69ajuqr2i
I have faced these problems too. You need to install Python 3.6 or 3.7 .
Before that you have to install cmake and set up visual studio as c++ desktop development then install dlib

(Python 3.7.0) (Windows 10) (Bash Terminal) Can't install dlib via pip3 [duplicate]

This question already has answers here:
dlib installation on Windows 10
(19 answers)
Closed 3 years ago.
Everytime I do pip3 install dlib, I receive errors such as "Failed with error code 1" and "CMake Error in CMakeLists.txt" and I have noticed that some work when I try to install other modules like numpy or pillow. And I am also using Visual Studio Code and bash for the terminal. I have tried to do it in the command prompt but it comes out with the same error.
Here is the full report:
David#Davids-PC MINGW64 ~/Desktop/Hello
$ pip3 install dlib
Collecting dlib
Using cached https://files.pythonhosted.org/packages/df/aa/6a9bb2a763107bb2606d6ee1aa65fcd3b51375a9ef6436e9c9280b0dd63c/dlib-19.15.0.tar.gz
Installing collected packages: dlib
Running setup.py install for dlib ... error
Complete output from command c:\users\david\appdata\local\programs\python\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\David\\AppData\\Local\\Temp\\pip-install-56zr1ps9\\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\David\AppData\Local\Temp\pip-record-zk0bruog\install-record.txt --single-version-externally-managed --compile:
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.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\David\AppData\Local\Temp\pip-install-56zr1ps9\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\David\AppData\Local\Temp\pip-install-56zr1ps9\dlib\build\lib.win-amd64-3.7 -DPYTHON_EXECUTABLE=c:\users\david\appdata\local\programs\python\python37\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\David\AppData\Local\Temp\pip-install-56zr1ps9\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/David/AppData/Local/Temp/pip-install-56zr1ps9/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\David\AppData\Local\Temp\pip-install-56zr1ps9\dlib\setup.py", line 257, in <module>
'Topic :: Software Development',
File "c:\users\david\appdata\local\programs\python\python37\lib\site-packages\setuptools\__init__.py", line 131, in setup
return distutils.core.setup(**attrs)
File "c:\users\david\appdata\local\programs\python\python37\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\david\appdata\local\programs\python\python37\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\users\david\appdata\local\programs\python\python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\david\appdata\local\programs\python\python37\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "c:\users\david\appdata\local\programs\python\python37\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "c:\users\david\appdata\local\programs\python\python37\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\david\appdata\local\programs\python\python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\david\appdata\local\programs\python\python37\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\david\appdata\local\programs\python\python37\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\david\appdata\local\programs\python\python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\David\AppData\Local\Temp\pip-install-56zr1ps9\dlib\setup.py", line 133, in run
self.build_extension(ext)
File "C:\Users\David\AppData\Local\Temp\pip-install-56zr1ps9\dlib\setup.py", line 170, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\users\david\appdata\local\programs\python\python37\lib\subprocess.py", line 328, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\David\\AppData\\Local\\Temp\\pip-install-56zr1ps9\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\David\\AppData\\Local\\Temp\\pip-install-56zr1ps9\\dlib\\build\\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=c:\\users\\david\\appdata\\local\\programs\\python\\python37\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\David\\AppData\\Local\\Temp\\pip-install-56zr1ps9\\dlib\\build\\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
Command "c:\users\david\appdata\local\programs\python\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\David\\AppData\\Local\\Temp\\pip-install-56zr1ps9\\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\David\AppData\Local\Temp\pip-record-zk0bruog\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\David\AppData\Local\Temp\pip-install-56zr1ps9\dlib\
Thank you for your suggestions but I installed it through a different way by using Anaconda with the command Conda install dlib in the Anaconda Prompt then created an environment for it. After that, I used Anaconda 5.3.0 in VSCode then started coding.

Categories

Resources