[PYTHON] What to do if you get an error when installing Dlib (Ubuntu)

environment

error

(Full text)

    Running setup.py install for dlib ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-3kh7uz0l/dlib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-3kh7uz0l/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 /tmp/pip-record-za_imyet/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/oae/.local/include/python3.8/dlib
         cwd: /tmp/pip-install-3kh7uz0l/dlib/
    Complete output (55 lines):
    running install
    running build
    running build_py
    package init file 'tools/python/dlib/__init__.py' not found (or not a regular file)
    running build_ext
    Traceback (most recent call last):
      File "/tmp/pip-install-3kh7uz0l/dlib/setup.py", line 120, in get_cmake_version
        out = subprocess.check_output(['cmake', '--version'])
      File "/usr/lib/python3.8/subprocess.py", line 411, in check_output
        return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
      File "/usr/lib/python3.8/subprocess.py", line 489, in run
        with Popen(*popenargs, **kwargs) as process:
      File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: 'cmake'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-3kh7uz0l/dlib/setup.py", line 223, in <module>
        setup(
      File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 144, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/lib/python3.8/distutils/command/install.py", line 589, in run
        self.run_command('build')
      File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/usr/lib/python3.8/distutils/command/build.py", line 135, in run
        self.run_command(cmd_name)
      File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/tmp/pip-install-3kh7uz0l/dlib/setup.py", line 129, in run
        cmake_version = self.get_cmake_version()
      File "/tmp/pip-install-3kh7uz0l/dlib/setup.py", line 122, in get_cmake_version
        raise RuntimeError("\n*******************************************************************\n" +
    RuntimeError:
    *******************************************************************
     CMake must be installed to build the following extensions: _dlib_pybind11
    *******************************************************************

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


ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-3kh7uz0l/dlib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-3kh7uz0l/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 /tmp/pip-record-za_imyet/install-record.txt --single-version-externally-managed --user --prefix= --com

Cause

--Cmake is not installed

Fix

sudo apt install cmake

:)

Recommended Posts

What to do if you get an error when installing Dlib (Ubuntu)
What to do if you get an error when installing python with pyenv
What to do if you get an OpenSSL error when installing Python 2 with pyenv
What to do if you get an error when trying to load mnist
What to do if you get an error when importing matplotlib in Python (Mac)
What to do if you get an Import Error when importing matplotlib with Jupyter
What to do if you get an error when running "certbot renew" in CakePHP environment
What to do if you get an Undefined error when trying to use pip with pyenv
What to do if you get an "unknown service" error from your gRPC server
What to do if you get a memory error when converting from PySparkDataFrame to PandasDataFrame
What to do if you get the error ʻERR_FEATURE_UNAVAILABLE_ON_PLATFORM` when using ts-node-dev on Linux
What to do if you get an error when trying to send a message in tasks.loop () immediately after startup
What to do when you get an error saying "Name resolution temporarily failed" on linux
What to do if an error occurs when importing numpy with VScode
What to do if you get the error "Error: opencv3: Does not support building both Python 2 and 3 wrappers" when installing openCV 3
What to do if you get an error saying c compiler cannot create executables in configure
What to do if you get a must override `get_config` error when trying to model.save in Keras
What to do if you get angry if you don't have libxml / xmlversion.h when installing lxml on CentOS
What to do if you get an error when vagrant up when you enable public_network or private_network on Vagrant + Arch Linux → Install netctl
Workaround if you get an error when trying to install PySide with pip
What to do if an SSL connection error (ssl.SSLError: [SSL: DH_KEY_TOO_SMALL]) occurs on Ubuntu 20.04
What to do when Ubuntu crashes
What to do if you get "The session could not be opened" when installing CentOS on VirtualBox
What to do if you get a Permission denied (public key) error when trying to pull on Github
What to do if you get "coverage unknown" in Coveralls
What to do when an error occurs with import _ssl
What to do if you get "(35,'SSL connect error')" in pycurl (one of them)
What to do if you run python in IntelliJ and end with an error
What to do after installing Linux (Ubuntu)
What to do if you get a minus zero in Python
[Beanstalk] What to do when an error occurs with import uuid
What to do if you get a UnicodeDecodeError with pip install
What to do when you get "I can't see the site !!!!"
What to do if you get Swagger-codegen in python and Import Error: No module named
What to do if you get a Cannot retrieve metalink for repository error in yum
What to do if you can't pipenv shell
What to do if you couldn't send an email to Yahoo with Python.
What to do if you get lost in file reference with FileNotFoundError
What to do if you get angry in TensorFlow v2 without attribute'app'
What to do if you get stuck during Anaconda installation on Linux
What to do if pyenv install does not proceed with an error
[Python] What to do when an error related to SSL authentication is returned
What to do if you get a TypeError with numpy min, max
What to do if you get Could not fetch URL 443 with pip
[OSX] [pyenv] What to do when an SSL error occurs in pip
What to do when psycopg2 throws an error when pipenv lock under Pipenv environment
EC2 / Amazon Linux2: What to do if you get an "unable to execute'gcc': No such file or directory" error with pip install
What to do if you get a "Wrong Python Platform" warning when using Python with the NetBeans IDE
What to do if you get angry with "Value Error: unknown local: UTF-8" in python manage.py syncdb
[Django] What to do if an Integrity Error occurs when registering data from the management site to the database
[Python] What to do if you get a ModuleNotFoundError when importing pandas using Jupyter Notebook in Anaconda
What to do if you get the error Target WSGI script'/var/www/xxx/xxx.wsgi' cannot be loaded as python module
What to do if you get angry with swapon failed: Operation not permitted
[python] What to do when an error occurs in send_keys of headless chrome
What to do if you get "Python not configured." Using PyDev in Eclipse
[Python] What to check when you get a Unicode Decode Error in Django
If you get a long error when tabbing an interactive shell with Anaconda
What to do if you can't pip install mysqlclient
No module named What to do if you get'libs.resources'
ModuleNotFoundError: No module What to do if you get'tensorflow.contrib'
When you get an error in python scraping (requests)