RuntimeError: CMake must be installed to build the following extensions: dlib - python

I have already installed CMake by pip install cmake and tried to install face_recognition but it still gives me a RuntimeError. I'm using 'Python 3.7.3, x32'
I also tried to install the dlib by pip install dlib since it is one of the reasons why I can't install face_recognition.
C:\Users\user>python -m pip install cmake
Requirement already satisfied: cmake in c:\users\user\appdata\roaming\python\python37\site-packages (3.14.4)
C:\Users\user>python -m pip install dlib
Collecting dlib
Using cached https://files.pythonhosted.org/packages/05/57/e8a8caa3c89a27f80bc78da39c423e2553f482a3705adc619176a3a24b36/dlib-19.17.0.tar.gz
Installing collected packages: dlib
Running setup.py install for dlib ... error
ERROR: Complete output from command 'C:\Python\Python37\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-24vk6act\\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-yf2kdjpx\install-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
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Temp\pip-install-24vk6act\dlib\setup.py", line 120, in get_cmake_version
out = subprocess.check_output(['cmake', '--version'])
File "C:\Python\Python37\lib\subprocess.py", line 395, in check_output
**kwargs).stdout
File "C:\Python\Python37\lib\subprocess.py", line 472, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Python\Python37\lib\subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "C:\Python\Python37\lib\subprocess.py", line 1178, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\user\AppData\Local\Temp\pip-install-24vk6act\dlib\setup.py", line 261, in <module>
'Topic :: Software Development',
File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\setuptools\__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "C:\Python\Python37\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Python\Python37\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\Python\Python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "C:\Python\Python37\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "C:\Python\Python37\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Python\Python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Python\Python37\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Python\Python37\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Python\Python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\user\AppData\Local\Temp\pip-install-24vk6act\dlib\setup.py", line 129, in run
cmake_version = self.get_cmake_version()
File "C:\Users\user\AppData\Local\Temp\pip-install-24vk6act\dlib\setup.py", line 125, in get_cmake_version
"\n*******************************************************************\n")
RuntimeError:
*******************************************************************
CMake must be installed to build the following extensions: dlib
*******************************************************************
----------------------------------------
ERROR: Command "'C:\Python\Python37\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-24vk6act\\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-yf2kdjpx\install-record.txt' --single-version-externally-managed --compile" failed with error code 1 in C:\Users\user\AppData\Local\Temp\pip-install-24vk6act\dlib\

Download and install dlib wheel from here
Then pip install face_recognition
pip install cmake
In visual studio, Individual Components
tab,Visual C++ tools for Cmake checkbox under Compilers,build tools
and runtimes Section
On Visual Studio Command prompt run, pip install face_recognition
Source

What works for is ...
After getting lots of Red Errors, I run following
conda install -c conda-forge dlib
pip install cmake
pip install face_recognition
Even the error says me to reinstall VS Code for c++. but above sequential installation works.
Python version was 3.8

Try install dlib using conda
conda install -c conda-forge dlib

For me, non of the solutions didn't work. Then, I downloaded all libraries in face_recognition package manually (like "pip install dlib==19.7", "pip install Click". At last, I installed face recognition with this command "pip install --no-deps face_recognition"

Related

python wmm2020 module importing error, what is the issue? [duplicate]

Facing the following error while installing dlib for the OpenCV project. It shows that
CMake must be installed to build the following extensions: dlib.
Command Output:
Collecting dlib==19.18.0
Using cached dlib-19.18.0.tar.gz (3.1 MB)
Using legacy 'setup.py install' for dlib, since package 'wheel' is not installed.
Installing collected packages: dlib
Running setup.py install for dlib: started
Running setup.py install for dlib: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: 'D:\Install Drive\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\mahmu\\AppData\\Local\\Temp\\pip-install-a4s1a_zh\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\mahmu\\AppData\\Local\\Temp\\pip-install-a4s1a_zh\\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\mahmu\AppData\Local\Temp\pip-record-mjm6k3c3\install-record.txt' --single-version-externally-managed --compile --install-headers 'D:\Install Drive\Include\dlib'
cwd: C:\Users\mahmu\AppData\Local\Temp\pip-install-a4s1a_zh\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)
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
Traceback (most recent call last):
File "C:\Users\mahmu\AppData\Local\Temp\pip-install-a4s1a_zh\dlib\setup.py", line 120, in get_cmake_version
out = subprocess.check_output(['cmake', '--version'])
File "D:\Install Drive\lib\subprocess.py", line 424, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "D:\Install Drive\lib\subprocess.py", line 505, in run
with Popen(*popenargs, **kwargs) as process:
File "D:\Install Drive\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "D:\Install Drive\lib\subprocess.py", line 1420, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\mahmu\AppData\Local\Temp\pip-install-a4s1a_zh\dlib\setup.py", line 223, in <module>
setup(
File "D:\Install Drive\lib\site-packages\setuptools\__init__.py", line 165, in setup
return distutils.core.setup(**attrs)
File "D:\Install Drive\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "D:\Install Drive\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "D:\Install Drive\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "D:\Install Drive\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "D:\Install Drive\lib\distutils\command\install.py", line 546, in run
self.run_command('build')
File "D:\Install Drive\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "D:\Install Drive\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "D:\Install Drive\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "D:\Install Drive\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "D:\Install Drive\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\mahmu\AppData\Local\Temp\pip-install-a4s1a_zh\dlib\setup.py", line 129, in run
cmake_version = self.get_cmake_version()
File "C:\Users\mahmu\AppData\Local\Temp\pip-install-a4s1a_zh\dlib\setup.py", line 122, in get_cmake_version
raise RuntimeError("\n*******************************************************************\n" +
RuntimeError:
*******************************************************************
CMake must be installed to build the following extensions: dlib
*******************************************************************
----------------------------------------
ERROR: Command errored out with exit status 1: 'D:\Install Drive\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\mahmu\\AppData\\Local\\Temp\\pip-install-a4s1a_zh\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\mahmu\\AppData\\Local\\Temp\\pip-install-a4s1a_zh\\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\mahmu\AppData\Local\Temp\pip-record-mjm6k3c3\install-record.txt' --single-version-externally-managed --compile --install-headers 'D:\Install Drive\Include\dlib' Check the logs for full command output.
WARNING: You are using pip version 20.2.3; however, version 21.1.2 is available.
You should consider upgrading via the 'D:\Install Drive\python.exe -m pip install --upgrade pip' command.
Notice that in the output that "CMake must be installed to build the following extensions: dlib". So install CMake first and only then try to install dlib. If CMake is installed, try updating your pip version to 21.1.2 via "D:\Install Drive\python.exe -m pip install --upgrade pip".
It requires cmake must be installed before installing dlib. Do execute in the following order.
pip install cmake
pip install dlib
This will fix the issue.

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**

ModuleNotFoundError: No module named ‘tools.nnwrap’ (windows)

I am trying to install PyTorch but every time it throws the same error ( ModuleNotFoundError: No module named ‘tools.nnwrap’).
This is what is typed: pip install torch
This is what I get every time:
Collecting torch
Using cached https://files.pythonhosted.org/packages/f8/02/880b468bd382dc79896eaecbeb8ce95e9c4b99a24902874a2cef0b562cea/torch-0.1.2.post2.tar.gz
Requirement already satisfied: pyyaml in c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages (from torch) (5.1.2)
Installing collected packages: torch
Running setup.py install for torch … error
ERROR: Command errored out with exit status 1:
command: ‘c:\users\user\appdata\local\programs\python\python37-32\python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"‘C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\torch\setup.py’"’"’; file=’"’"‘C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\torch\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-b_c49sh\install-record.txt’ --single-version-externally-managed --compile
cwd: C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\torch
Complete output (23 lines):
running install
running build_deps
Traceback (most recent call last):
File “<string>”, line 1, in <module>
File “C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\torch\setup.py”, line 265, in
description=“Tensors and Dynamic neural networks in Python with strong GPU acceleration”,
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\setuptools_init.py", line 145, in setup
return distutils.core.setup(**attrs)
File “C:\Users\User\AppData\Local\Programs\Python\Python37-32\Lib\distutils\core.py”, line 148, in setup
dist.run_commands()
File “C:\Users\User\AppData\Local\Programs\Python\Python37-32\Lib\distutils\dist.py”, line 966, in run_commands
self.run_command(cmd)
File “C:\Users\User\AppData\Local\Programs\Python\Python37-32\Lib\distutils\dist.py”, line 985, in run_command
cmd_obj.run()
File “C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\torch\setup.py”, line 99, in run
self.run_command(‘build_deps’)
File “C:\Users\User\AppData\Local\Programs\Python\Python37-32\Lib\distutils\cmd.py”, line 313, in run_command
self.distribution.run_command(command)
File “C:\Users\User\AppData\Local\Programs\Python\Python37-32\Lib\distutils\dist.py”, line 985, in run_command
cmd_obj.run()
File “C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\torch\setup.py”, line 51, in run
from tools.nnwrap import generate_wrappers as generate_nn_wrappers
ModuleNotFoundError: No module named ‘tools.nnwrap’
----------------------------------------
ERROR: Command errored out with exit status 1: ‘c:\users\user\appdata\local\programs\python\python37-32\python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"‘C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\torch\setup.py’"’"’; file=’"’"‘C:\Users\User\AppData\Local\Temp\pip-install-oegjniuy\torch\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-_b_c49sh\install-record.txt’ --single-version-externally-managed --compile Check the logs for full command output.
Do anyone knows how to fix this error!!
# for OS: Windows, package: pip, Language: python3.6 (below command is valid for only mentioned python 3.6)
pip3 install https://download.pytorch.org/whl/cu90/torch-1.1.0-cp36-cp36m-win_amd64.whl
pip3 install https://download.pytorch.org/whl/cu90/torchvision-0.3.0-cp36-cp36m-win_amd64.whl
For another version/type of the software (OS, package, Language) installed, the command must be generated from the below-mentioned link: https://pytorch.org/get-started/locally/
It is recommended to directly get the desired URL that matches system configuration from the Pytorch website-https://pytorch.org/get-started/locally/
Select the options that meet your system config and using anaconda pip install the url
Try to paste the command
pip install torch==1.7.1+cpu torchvision==0.8.2+cpu torchaudio===0.7.2 -f https://download.pytorch.org/whl/torch_stable.html
in the Anaconda Prompt. Worked for me.

getting Error in installing Dlib using pip

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

(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