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 vs code window 10/11 can you please guide
ERROR:
(myenv) F:\PYTHON\FaceRecognition>pip install face_recognition
Collecting face_recognition
Using cached face_recognition-1.3.0-py2.py3-none-any.whl (15 kB)
Collecting face-recognition-models>=0.3.0 (from face_recognition)
Using cached face_recognition_models-0.3.0-py2.py3-none-any.whl
Collecting Click>=6.0 (from face_recognition)
Using cached click-8.1.7-py3-none-any.whl (97 kB)
Collecting dlib>=19.7 (from face_recognition)
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
Requirement already satisfied: numpy in f:\python\facerecognition\myenv\lib\site-packages (from face_recognition) (1.25.2)
Collecting Pillow (from face_recognition)
Using cached Pillow-10.0.0-cp311-cp311-win_amd64.whl (2.5 MB)
Collecting colorama (from Click>=6.0->face_recognition)
Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB)
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\asad4\AppData\Local\Temp\pip-install-yzj24ii4\dlib_9e9a5d63f31b40ac926778278f91eca0\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\asad4\AppData\Local\Temp\pip-install-yzj24ii4\dlib_9e9a5d63f31b40ac926778278f91eca0\build\lib.win-amd64-cpython-311 -DPYTHON_EXECUTABLE=F:\PYTHON\FaceRecognition\myenv\Scripts\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\asad4\AppData\Local\Temp\pip-install-yzj24ii4\dlib_9e9a5d63f31b40ac926778278f91eca0\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