How to solve CMake must be installed to build the following extensions: dlib in PyCharm?

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 Drivepython.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('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersmahmuAppDataLocalTemppip-record-mjm6k3c3install-record.txt' --single-version-externally-managed --compile --install-headers 'D:Install DriveIncludedlib'
         cwd: C:UsersmahmuAppDataLocalTemppip-install-a4s1a_zhdlib
    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:UsersmahmuAppDataLocalTemppip-install-a4s1a_zhdlibsetup.py", line 120, in get_cmake_version
        out = subprocess.check_output(['cmake', '--version'])
      File "D:Install Drivelibsubprocess.py", line 424, in check_output
        return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
      File "D:Install Drivelibsubprocess.py", line 505, in run
        with Popen(*popenargs, **kwargs) as process:
      File "D:Install Drivelibsubprocess.py", line 951, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File "D:Install Drivelibsubprocess.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:UsersmahmuAppDataLocalTemppip-install-a4s1a_zhdlibsetup.py", line 223, in <module>
        setup(
      File "D:Install Drivelibsite-packagessetuptools__init__.py", line 165, in setup
        return distutils.core.setup(**attrs)
      File "D:Install Drivelibdistutilscore.py", line 148, in setup
        dist.run_commands()
      File "D:Install Drivelibdistutilsdist.py", line 966, in run_commands
        self.run_command(cmd)
      File "D:Install Drivelibdistutilsdist.py", line 985, in run_command
        cmd_obj.run()
      File "D:Install Drivelibsite-packagessetuptoolscommandinstall.py", line 61, in run
        return orig.install.run(self)
      File "D:Install Drivelibdistutilscommandinstall.py", line 546, in run
        self.run_command('build')
      File "D:Install Drivelibdistutilscmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "D:Install Drivelibdistutilsdist.py", line 985, in run_command
        cmd_obj.run()
      File "D:Install Drivelibdistutilscommandbuild.py", line 135, in run
        self.run_command(cmd_name)
      File "D:Install Drivelibdistutilscmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "D:Install Drivelibdistutilsdist.py", line 985, in run_command
        cmd_obj.run()
      File "C:UsersmahmuAppDataLocalTemppip-install-a4s1a_zhdlibsetup.py", line 129, in run
        cmake_version = self.get_cmake_version()
      File "C:UsersmahmuAppDataLocalTemppip-install-a4s1a_zhdlibsetup.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 Drivepython.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('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersmahmuAppDataLocalTemppip-record-mjm6k3c3install-record.txt' --single-version-externally-managed --compile --install-headers 'D:Install DriveIncludedlib' 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 Drivepython.exe -m pip install --upgrade pip' command.

1

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.

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 Drivepython.exe -m pip install –upgrade pip”.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa

How to solve CMake must be installed to build the following extensions: dlib in PyCharm?

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 Drivepython.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('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersmahmuAppDataLocalTemppip-record-mjm6k3c3install-record.txt' --single-version-externally-managed --compile --install-headers 'D:Install DriveIncludedlib'
         cwd: C:UsersmahmuAppDataLocalTemppip-install-a4s1a_zhdlib
    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:UsersmahmuAppDataLocalTemppip-install-a4s1a_zhdlibsetup.py", line 120, in get_cmake_version
        out = subprocess.check_output(['cmake', '--version'])
      File "D:Install Drivelibsubprocess.py", line 424, in check_output
        return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
      File "D:Install Drivelibsubprocess.py", line 505, in run
        with Popen(*popenargs, **kwargs) as process:
      File "D:Install Drivelibsubprocess.py", line 951, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File "D:Install Drivelibsubprocess.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:UsersmahmuAppDataLocalTemppip-install-a4s1a_zhdlibsetup.py", line 223, in <module>
        setup(
      File "D:Install Drivelibsite-packagessetuptools__init__.py", line 165, in setup
        return distutils.core.setup(**attrs)
      File "D:Install Drivelibdistutilscore.py", line 148, in setup
        dist.run_commands()
      File "D:Install Drivelibdistutilsdist.py", line 966, in run_commands
        self.run_command(cmd)
      File "D:Install Drivelibdistutilsdist.py", line 985, in run_command
        cmd_obj.run()
      File "D:Install Drivelibsite-packagessetuptoolscommandinstall.py", line 61, in run
        return orig.install.run(self)
      File "D:Install Drivelibdistutilscommandinstall.py", line 546, in run
        self.run_command('build')
      File "D:Install Drivelibdistutilscmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "D:Install Drivelibdistutilsdist.py", line 985, in run_command
        cmd_obj.run()
      File "D:Install Drivelibdistutilscommandbuild.py", line 135, in run
        self.run_command(cmd_name)
      File "D:Install Drivelibdistutilscmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "D:Install Drivelibdistutilsdist.py", line 985, in run_command
        cmd_obj.run()
      File "C:UsersmahmuAppDataLocalTemppip-install-a4s1a_zhdlibsetup.py", line 129, in run
        cmake_version = self.get_cmake_version()
      File "C:UsersmahmuAppDataLocalTemppip-install-a4s1a_zhdlibsetup.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 Drivepython.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('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersmahmuAppDataLocalTemppip-record-mjm6k3c3install-record.txt' --single-version-externally-managed --compile --install-headers 'D:Install DriveIncludedlib' 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 Drivepython.exe -m pip install --upgrade pip' command.

1

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.

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 Drivepython.exe -m pip install –upgrade pip”.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật