dlib: Building wheel for dlib (setup.py) ... error

Hello i’m trying to install dlib using pip install dlibbut i get an error.

This is the error:

G:\Gedeelde drives\4TW_2022-2023_T1(Lucas-Bram-Senne)\2. Persoonlijk\2. Lucas N\Test gezichtsherkenning\Test>pip install dlib
Collecting dlib
  Using cached dlib-19.24.0.tar.gz (3.2 MB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: dlib
  Building wheel for dlib (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      running bdist_wheel
      running build
      running build_py
      package init file 'tools\python\dlib\__init__.py' not found (or not a regular file)
      running build_ext

      ERROR: CMake must be installed to build dlib

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  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: subprocess-exited-with-error

  × Running setup.py install for dlib did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      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

      ERROR: CMake must be installed to build dlib

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> dlib

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

i’am using python 3.8.2 I got dlib automaticly using pip install dlib i’am using windows 10 64 bit

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 30 (5 by maintainers)

Most upvoted comments

Hi Lucas, I am facing same error, How did you get it resolved.

I used this tuturial. https://medium.com/analytics-vidhya/how-to-install-dlib-library-for-python-in-windows-10-57348ba1117f I forgot to install visual studio.

i tried this conda install -c conda-forge dlib and it worked

My solution for this problem was: 1 Download the dlib zip from https://pypi.org/project/dlib/#files 2 Extract and cd into the folder with powershell(running as admin) 3 Execute python setup.py install Done

You can do the following:

  1. Clone or download the project: https://github.com/sachadee/Dlib
  2. Please note that dlib works with Python 3.7, 3.8 and 3.9
  3. Open cmd in the directory of project
  4. According to your python version (cp37 is python 3.7, cp38 is python 3.8, cp39 is python 3.9) pip install the library. Example: pip install dlib-19.22.99-cp38-cp38-win_amd64.whl

The solution does not belong to me. Source: https://www.youtube.com/watch?v=BUu6hrcYI_c

I hope that solves your problem

You are using Visual Studio 16 2019. v16 is old. Try at least v17.

Hello i’m trying to install dlib using pip install dlibbut i get an error,I found that it’s impossible to install it. There is no working solution on the internet

This is the error:pip install dlib Collecting dlib Using cached dlib-19.24.2.tar.gz (11.8 MB) Installing build dependencies … done Getting requirements to build wheel … done Preparing metadata (pyproject.toml) … done Building wheels for collected packages: dlib Building wheel for dlib (pyproject.toml) … error error: subprocess-exited-with-error

× Building wheel for dlib (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [179 lines of output] running bdist_wheel running build running build_ext <string>:125: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
Building extension for Python 3.11.4 | packaged by Anaconda, Inc. | (main, Jul 5 2023, 13:38:37) [MSC v.1916 64 bit (AMD64)] Invoking CMake setup: ‘cmake C:\Users\Admin\AppData\Local\Temp\pip-install-i2hv9wmd\dlib_f9295363cbb04261a954619 7b7d35461\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Admin\AppData\Local\Temp\pip-install-i2hv9wmd\dlib_f9 295363cbb04261a9546197b7d35461\build\lib.win-amd64-cpython-311 -DPYTHON_EXECUTABLE=F:\Anaconda\python.exe -DCMAKE_LIBR ARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Admin\AppData\Local\Temp\pip-install-i2hv9wmd\dlib_f9295363cbb04261a9546197b7d35461\build\lib.win-amd64-cpython-311 -A x64’ – Building for: Visual Studio 17 2022 – Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631. – The C compiler identification is MSVC 19.38.33133.0 – The CXX compiler identification is MSVC 19.38.33133.0 – Detecting C compiler ABI info – Detecting C compiler ABI info - done – Check for working C compiler: G:/VisualStudio/community2023/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe - skipped – Detecting C compile features – Detecting C compile features - done – Detecting CXX compiler ABI info – Detecting CXX compiler ABI info - done – Check for working CXX compiler: G:/VisualStudio/community2023/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe - skipped – Detecting CXX compile features – Detecting CXX compile features - done CMake Deprecation Warning at C:/Users/Admin/AppData/Local/Temp/pip-install-i2hv9wmd/dlib_f9295363cbb04261a9546197b7d35461/dlib/external/pybind11/CMakeLists.txt:8 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake.

    Update the VERSION argument <min> value or use a ...<max> suffix to tell
    CMake that the project does not need compatibility with older versions.


  -- pybind11 v2.10.0
  CMake Warning (dev) at C:/Users/Admin/AppData/Local/Temp/pip-install-i2hv9wmd/dlib_f9295363cbb04261a9546197b7d35461/dlib/external/pybind11/tools/FindPythonLibsNew.cmake:98 (find_package):
    Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
    are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
    the cmake_policy command to set the policy and suppress this warning.

  Call Stack (most recent call first):
    C:/Users/Admin/AppData/Local/Temp/pip-install-i2hv9wmd/dlib_f9295363cbb04261a9546197b7d35461/dlib/external/pybind11/tools/pybind11Tools.cmake:50 (find_package)
    C:/Users/Admin/AppData/Local/Temp/pip-install-i2hv9wmd/dlib_f9295363cbb04261a9546197b7d35461/dlib/external/pybind11/tools/pybind11Common.cmake:180 (include)
    C:/Users/Admin/AppData/Local/Temp/pip-install-i2hv9wmd/dlib_f9295363cbb04261a9546197b7d35461/dlib/external/pybind11/CMakeLists.txt:200 (include)
  This warning is for project developers.  Use -Wno-dev to suppress it.

  -- Found PythonInterp: F:/Anaconda/python.exe (found suitable version "3.11.4", minimum required is "3.6")      
  -- Found PythonLibs: F:/Anaconda/libs/python311.lib
  -- Performing Test HAS_MSVC_GL_LTCG
  -- Performing Test HAS_MSVC_GL_LTCG - Success
  -- Using CMake version: 3.27.9
  -- Compiling dlib version: 19.24.2
  -- Looking for sys/types.h
  -- Looking for sys/types.h - found
  -- Looking for stdint.h
  -- Looking for stdint.h - found
  -- Looking for stddef.h
  -- Looking for stddef.h - found
  -- Check size of void*
  -- Check size of void* - done
  -- Enabling SSE2 instructions
  -- Could NOT find WebP (missing: WEBP_LIBRARY)
  -- Searching for BLAS and LAPACK
  -- Searching for BLAS and LAPACK
  -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
  -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
  -- Looking for pthread_create in pthreads
  -- Looking for pthread_create in pthreads - not found
  -- Looking for pthread_create in pthread
  -- Looking for pthread_create in pthread - not found
  -- Found Threads: TRUE
  CMake Warning (dev) at C:/Users/Admin/AppData/Local/Temp/pip-install-i2hv9wmd/dlib_f9295363cbb04261a9546197b7d35461/dlib/CMakeLists.txt:628 (find_package):
    Policy CMP0146 is not set: The FindCUDA module is removed.  Run "cmake
    --help-policy CMP0146" for policy details.  Use the cmake_policy command to
    set the policy and suppress this warning.

  This warning is for project developers.  Use -Wno-dev to suppress it.

  CUDA_TOOLKIT_ROOT_DIR not found or specified
  -- Could NOT find CUDA (missing: CUDA_TOOLKIT_ROOT_DIR CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY) (Required is at least version "7.5")
  -- Found CUDA, but CMake was unable to find the cuBLAS libraries that should be part of every basic CUDA install. Your CUDA install is somehow broken or incomplete. Since cuBLAS is required for dlib to use CUDA we won't use CUDA. 
  -- DID NOT FIND CUDA
  -- Disabling CUDA support for dlib.  DLIB WILL NOT USE CUDA
  -- Searching for FFMPEG/LIBAV
  -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
  -- PkgConfig could not be found, FFMPEG won't be available
  -- Configuring done (31.1s)
  -- Generating done (0.0s)
  -- Build files have been written to: C:/Users/Admin/AppData/Local/Temp/pip-install-i2hv9wmd/dlib_f9295363cbb04261a9546197b7d35461/build/temp.win-amd64-cpython-311/Release
  Invoking CMake build: 'cmake --build . --config Release -- /m'
  适用于 .NET Framework MSBuild 版本 17.8.3+195e7f5a3

  G:\VisualStudio\community2023\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(541,5): warning MSB8029: 中间

录或输出目录无法驻留在临时目录下,因为这可能会导致增量生成出现问题。 [C:\Users\Admin\AppData\Local\Temp\pip-install- -i2hv9wmd\dlib_f9295363cbb04261a9546197b7d35461\build\temp.win-amd64-cpython-311\Release\ZERO_CHECK.vcxproj] 1>Checking Build System G:\VisualStudio\community2023\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(541,5): warning MSB8029: 中间 录或输出目录无法驻留在临时目录下,因为这可能会导致增量生成出现问题。 [C:\Users\Admin\AppData\Local\Temp\pip-install- -i2hv9wmd\dlib_f9295363cbb04261a9546197b7d35461\build\temp.win-amd64-cpython-311\Release\dlib_build\dlib.vcxproj]
Building Custom Rule C:/Users/Admin/AppData/Local/Temp/pip-install-i2hv9wmd/dlib_f9295363cbb04261a9546197b7d35461/dlib/CMakeLists.txt base64_kernel_1.cpp bigint_kernel_1.cpp bigint_kernel_2.cpp bit_stream_kernel_1.cpp entropy_decoder_kernel_1.cpp entropy_decoder_kernel_2.cpp entropy_encoder_kernel_1.cpp entropy_encoder_kernel_2.cpp md5_kernel_1.cpp tokenizer_kernel_1.cpp unicode.cpp test_for_odr_violations.cpp fft.cpp sockets_kernel_1.cpp bsp.cpp dir_nav_kernel_1.cpp dir_nav_kernel_2.cpp dir_nav_extensions.cpp fonts.cpp linker_kernel_1.cpp extra_logger_headers.cpp logger_kernel_1.cpp logger_config_file.cpp misc_api_kernel_1.cpp misc_api_kernel_2.cpp sockets_extensions.cpp sockets_kernel_2.cpp sockstreambuf.cpp sockstreambuf_unbuffered.cpp server_kernel.cpp server_iostream.cpp server_http.cpp multithreaded_object_extension.cpp threaded_object_extension.cpp threads_kernel_1.cpp

  未经处理的异常:  OutOfMemoryException.
  Traceback (most recent call last):
    File "F:\Anaconda\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
      main()
    File "F:\Anaconda\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "F:\Anaconda\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 251, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\Admin\AppData\Local\Temp\pip-build-env-gr1hyoxj\overlay\Lib\site-packages\setuptools\build_meta.py", line 404, in build_wheel
      return self._build_with_temp_dir(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\Admin\AppData\Local\Temp\pip-build-env-gr1hyoxj\overlay\Lib\site-packages\setuptools\build_meta.py", line 389, in _build_with_temp_dir
      self.run_setup()
    File "C:\Users\Admin\AppData\Local\Temp\pip-build-env-gr1hyoxj\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
      exec(code, locals())
    File "<string>", line 218, in <module>
    File "C:\Users\Admin\AppData\Local\Temp\pip-build-env-gr1hyoxj\overlay\Lib\site-packages\setuptools\__init__.py", line 103, in setup
      return distutils.core.setup(**attrs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\Admin\AppData\Local\Temp\pip-build-env-gr1hyoxj\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
      return run_commands(dist)
             ^^^^^^^^^^^^^^^^^^
    File "C:\Users\Admin\AppData\Local\Temp\pip-build-env-gr1hyoxj\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
      dist.run_commands()
    File "C:\Users\Admin\AppData\Local\Temp\pip-build-env-gr1hyoxj\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
      self.run_command(cmd)
    File "C:\Users\Admin\AppData\Local\Temp\pip-build-env-gr1hyoxj\overlay\Lib\site-packages\setuptools\dist.py", line 963, in run_command
      super().run_command(command)
    File "C:\Users\Admin\AppData\Local\Temp\pip-build-env-gr1hyoxj\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
      cmd_obj.run()
    File "C:\Users\Admin\AppData\Local\Temp\pip-build-env-gr1hyoxj\overlay\Lib\site-packages\wheel\bdist_wheel.py", line 368, in run
      self.run_command("build")
    File "C:\Users\Admin\AppData\Local\Temp\pip-build-env-gr1hyoxj\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
      self.distribution.run_command(command)
    File "C:\Users\Admin\AppData\Local\Temp\pip-build-env-gr1hyoxj\overlay\Lib\site-packages\setuptools\dist.py", line 963, in run_command
      super().run_command(command)
    File "C:\Users\Admin\AppData\Local\Temp\pip-build-env-gr1hyoxj\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
      cmd_obj.run()
    File "C:\Users\Admin\AppData\Local\Temp\pip-build-env-gr1hyoxj\overlay\Lib\site-packages\setuptools\_distutils\command\build.py", line 131, in run
      self.run_command(cmd_name)
    File "C:\Users\Admin\AppData\Local\Temp\pip-build-env-gr1hyoxj\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
      self.distribution.run_command(command)
    File "C:\Users\Admin\AppData\Local\Temp\pip-build-env-gr1hyoxj\overlay\Lib\site-packages\setuptools\dist.py", line 963, in run_command

ERROR: Failed building wheel for dlib Failed to build dlib ERROR: Could not build wheels for dlib, which is required to install pyproject.toml-based projects

It will finish.

On Thu, May 11, 2023 at 11:21 PM tanmaymishra1551 @.***> wrote:

[image: 16838615752462759177002424192195] https://user-images.githubusercontent.com/83284368/237860868-e698c2fe-3d1c-4aaa-9b0f-4bcb34f357cb.jpg Taking too long is it installing or there is an error?

— Reply to this email directly, view it on GitHub https://github.com/davisking/dlib/issues/2671#issuecomment-1545053633, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPYFR3C4N23FVADJKCHAWLXFWUCNANCNFSM6AAAAAAQYAIAOM . You are receiving this because you commented.Message ID: @.***>

Maybe cmake isn’t in your path. If you open a terminal and type cmake and get error then it’s not going to work.

I installed cmake from the site and slect add to path. If i type cmake in cmd i works. image