Pre-reqs:
- Have Python 3 installed. On macOS, this could be installed from homebrew or even via standard Python 3.6 downloaded installer from https://www.python.org/download. On Linux, just use your package manager.
- On macOS:
- Install XCode from the Mac App Store (or install the XCode command line utils).
- Have homebrew installed
- On Linux:
- For a full list of apt packages required, check out the example Dockerfile and copy what's installed there.
- These instructions assume you are using Ubuntu 16.04 or newer. If you are using 14.04, you can try these installation instructions instead to work around the old CMake version.
- These instructions assume you don't have an nVidia GPU and don't have Cuda and cuDNN installed and don't want GPU acceleration (since none of the current Mac models support this).
Clone the code from github:
git clone https://github.com/davisking/dlib.git
Build the main dlib library (optional if you just want to use Python):
cd dlib
mkdir build; cd build; cmake ..; cmake --build .
Build and install the Python extensions:
cd ..
python3 setup.py install
At this point, you should be able to run python3
and type import dlib
successfully.
dlib installing issue using Command prompt and vs code both in window 11 can you please guide
PS C:\Users\TARUN PAUL\Coding> pip install cmake
Collecting cmake
Using cached cmake-3.28.1-py2.py3-none-win_amd64.whl.metadata (6.5 kB)
Using cached cmake-3.28.1-py2.py3-none-win_amd64.whl (35.8 MB)
Installing collected packages: cmake
Successfully installed cmake-3.28.1
PS C:\Users\TARUN PAUL\Coding> 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
╰─> [78 lines of output]
running bdist_wheel
running build
running build_ext
:125: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
Building extension for Python 3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\TARUN PAUL\AppData\Local\Temp\pip-install-ao8p44qq\dlib_871dc5b39a78423394254e859b7bb660\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\TARUN PAUL\AppData\Local\Temp\pip-install-ao8p44qq\dlib_871dc5b39a78423394254e859b7bb660\build\lib.win-amd64-cpython-311 -DPYTHON_EXECUTABLE=C:\Users\TARUN PAUL\AppData\Local\Programs\Python\Python311\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\TARUN PAUL\AppData\Local\Temp\pip-install-ao8p44qq\dlib_871dc5b39a78423394254e859b7bb660\build\lib.win-amd64-cpython-311 -A x64'
-- Building for: NMake Makefiles
CMake Error at CMakeLists.txt:5 (message):
note: This error originates from a subprocess, and is likely not a problem with pip.
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