Error installing dlib on Pycharm

0

1

I am trying to install dlib on Pycharm (which is similar to Anaconda) in order to use it for my Python and OpenCV face detection project.

I have installed cMake and upgraded Python but there is still an error:

Command

pip install dlib

Error

FileNotFoundError: [WinError 2] The system cannot find the file specified

Command output

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: started
Running setup.py install for dlib: finished with status 'error'
Complete output from command C:\Users\mehrs\PycharmProjects\project2\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\mehrs\\AppData\\Local\\Temp\\pycharm-packaging\\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\mehrs\AppData\Local\Temp\pip-record-_nvwlk_i\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\mehrs\PycharmProjects\project2\venv\include\site\python3.7\dlib:
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\mehrs\AppData\Local\Temp\pycharm-packaging\dlib\setup.py", line 120, in get_cmake_version
    out = subprocess.check_output(['cmake', '--version'])
  File "C:\Users\mehrs\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 395, in check_output
    **kwargs).stdout
  File "C:\Users\mehrs\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 472, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Users\mehrs\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "C:\Users\mehrs\AppData\Local\Programs\Python\Python37-32\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\mehrs\AppData\Local\Temp\pycharm-packaging\dlib\setup.py", line 261, in <module>
    'Topic :: Software Development',
  File "C:\Users\mehrs\PycharmProjects\project2\venv\lib\site-packages\setuptools-39.1.0-py3.7.egg\setuptools\__init__.py", line 129, in setup
  File "C:\Users\mehrs\AppData\Local\Programs\Python\Python37-32\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Users\mehrs\AppData\Local\Programs\Python\Python37-32\lib\distutils\dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "C:\Users\mehrs\AppData\Local\Programs\Python\Python37-32\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\mehrs\PycharmProjects\project2\venv\lib\site-packages\setuptools-39.1.0-py3.7.egg\setuptools\command\install.py", line 61, in run
  File "C:\Users\mehrs\AppData\Local\Programs\Python\Python37-32\lib\distutils\command\install.py", line 545, in run
    self.run_command('build')
  File "C:\Users\mehrs\AppData\Local\Programs\Python\Python37-32\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Users\mehrs\AppData\Local\Programs\Python\Python37-32\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\mehrs\AppData\Local\Programs\Python\Python37-32\lib\distutils\command\build.py", line 135, in run
    self.run_command(cmd_name)
  File "C:\Users\mehrs\AppData\Local\Programs\Python\Python37-32\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Users\mehrs\AppData\Local\Programs\Python\Python37-32\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\mehrs\AppData\Local\Temp\pycharm-packaging\dlib\setup.py", line 129, in run
    cmake_version = self.get_cmake_version()
  File "C:\Users\mehrs\AppData\Local\Temp\pycharm-packaging\dlib\setup.py", line 125, in get_cmake_version
    "\n*******************************************************************\n")
RuntimeError:
*******************************************************************
 CMake must be installed to build the following extensions: dlib
*******************************************************************


----------------------------------------

Command "C:\Users\mehrs\PycharmProjects\project2\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\mehrs\\AppData\\Local\\Temp\\pycharm-packaging\\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\mehrs\AppData\Local\Temp\pip-record-_nvwlk_i\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\mehrs\PycharmProjects\project2\venv\include\site\python3.7\dlib" failed with error code 1 in C:\Users\mehrs\AppData\Local\Temp\pycharm-packaging\dlib\
You are using pip version 10.0.1, however version 19.0.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

mama

Posted 2019-04-24T18:38:46.013

Reputation: 1

It appears you likely haven't registered cmake.exe at the command line (i.e. in your User/System PATH/Path variable(s)). – Anaksunaman – 2019-04-24T19:28:01.783

No answers