Face_recognition: Returning error while trying to install face_recognition in Docker Container

Created on 11 Mar 2018  路  1Comment  路  Source: ageitgey/face_recognition

Step 3/5 : RUN pip install face_recognition
 ---> Running in 9ff413f2c348
Collecting face_recognition
  Downloading face_recognition-1.2.1-py2.py3-none-any.whl
Collecting Click>=6.0 (from face_recognition)
  Downloading click-6.7-py2.py3-none-any.whl (71kB)
Collecting scipy>=0.17.0 (from face_recognition)
  Downloading scipy-1.0.0-cp27-cp27mu-manylinux1_x86_64.whl (46.7MB)
Collecting face-recognition-models>=0.3.0 (from face_recognition)
  Downloading face_recognition_models-0.3.0.tar.gz (100.1MB)
Collecting Pillow (from face_recognition)
  Downloading Pillow-5.0.0-cp27-cp27mu-manylinux1_x86_64.whl (5.8MB)
Collecting dlib>=19.7 (from face_recognition)
  Downloading dlib-19.9.0.tar.gz (3.1MB)
Collecting numpy (from face_recognition)
  Downloading numpy-1.14.1-cp27-cp27mu-manylinux1_x86_64.whl (12.1MB)
Building wheels for collected packages: face-recognition-models, dlib
  Running setup.py bdist_wheel for face-recognition-models: started
  Running setup.py bdist_wheel for face-recognition-models: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/05/32/f2/440351db9ce1eb483696f83300f3d313f2f265403f0e69c481
  Running setup.py bdist_wheel for dlib: started
  Running setup.py bdist_wheel for dlib: finished with status 'error'
  Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-Kznmb_/dlib/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmplx4FErpip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  package init file 'dlib/__init__.py' not found (or not a regular file)
  running build_ext
  Invoking CMake setup: 'cmake /tmp/pip-build-Kznmb_/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-build-Kznmb_/dlib/build/lib.linux-x86_64-2.7 -DPYTHON_EXECUTABLE=/usr/bin/python -DCMAKE_BUILD_TYPE=Release'
  error: [Errno 2] No such file or directory

  ----------------------------------------
  Failed building wheel for dlib
  Running setup.py clean for dlib
Successfully built face-recognition-models
Failed to build dlib
Installing collected packages: Click, numpy, scipy, face-recognition-models, Pillow, dlib, face-recognition
  Running setup.py install for dlib: started
    Running setup.py install for dlib: finished with status 'error'
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-Kznmb_/dlib/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-_FCt88-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    package init file 'dlib/__init__.py' not found (or not a regular file)
    running build_ext
    Invoking CMake setup: 'cmake /tmp/pip-build-Kznmb_/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-build-Kznmb_/dlib/build/lib.linux-x86_64-2.7 -DPYTHON_EXECUTABLE=/usr/bin/python -DCMAKE_BUILD_TYPE=Release'
    error: [Errno 2] No such file or directory

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-Kznmb_/dlib/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-_FCt88-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-Kznmb_/dlib/
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The command '/bin/sh -c pip install face_recognition' returned a non-zero code: 1

My docker file:

FROM ubuntu:16.04

# Update

# Install app dependencies
RUN apt-get update && apt-get install -y \
    python-pip
RUN pip install face_recognition

# Bundle app source
COPY . /usr/src/app
CMD ["python", "face.py"]

Most helpful comment

You need additional things installed to compile dlib.

Instead of starting from scratch, you can just use the sample Dockerfile I provided with the code: https://github.com/ageitgey/face_recognition/blob/master/Dockerfile

>All comments

You need additional things installed to compile dlib.

Instead of starting from scratch, you can just use the sample Dockerfile I provided with the code: https://github.com/ageitgey/face_recognition/blob/master/Dockerfile

Was this page helpful?
0 / 5 - 0 ratings

Related issues

damey2011 picture damey2011  路  3Comments

Nijinsha picture Nijinsha  路  5Comments

dharam1890 picture dharam1890  路  3Comments

lfjd05 picture lfjd05  路  3Comments

carlhung picture carlhung  路  6Comments