Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

Install dlib and face_recognition on a Raspberry Pi

Instructions tested with a Raspberry Pi 2 with an 8GB memory card. Probably also works fine on a Raspberry Pi 3.

Steps

Download the latest Raspbian Jessie Light image. Earlier versions of Raspbian won't work.

Write it to a memory card using Etcher, put the memory card in the RPi and boot it up.

Log in. Default username / password is pi / raspberry.

Set up Wifi (if you are using Wifi) according to the Raspberry Pi instructions.

Run sudo raspi-config and configure the basics:

  • Set up your keyboard layout (It defaults to a British keyboard layout)
  • Change default user password
  • Enable the Raspberry Pi camera (if you have one attached)
  • Configure gpu memory split under 'Advanced'. Set it up '16'.
  • Save changes and reboot.

Install required libraries with these commands:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential \
    cmake \
    gfortran \
    git \
    wget \
    curl \
    graphicsmagick \
    libgraphicsmagick1-dev \
    libatlas-dev \
    libavcodec-dev \
    libavformat-dev \
    libboost-all-dev \
    libgtk2.0-dev \
    libjpeg-dev \
    liblapack-dev \
    libswscale-dev \
    pkg-config \
    python3-dev \
    python3-numpy \
    python3-pip \
    zip
sudo apt-get clean

Install the picamera python library with array support (if you are using a camera):

sudo apt-get install python3-picamera
sudo pip3 install --upgrade picamera[array]

Temporarily enable a larger swap file size (so the dlib compile won't fail due to limited memory):

sudo nano /etc/dphys-swapfile

< change CONF_SWAPSIZE=100 to CONF_SWAPSIZE=1024 and save / exit nano >

sudo /etc/init.d/dphys-swapfile restart

Download and install dlib v19.6:

mkdir -p dlib
git clone -b 'v19.6' --single-branch https://github.com/davisking/dlib.git dlib/
cd ./dlib
sudo python3 setup.py install --compiler-flags "-mfpu=neon"

Install face_recognition:

sudo pip3 install face_recognition

Revert the swap file size change now that dlib is installed:

sudo nano /etc/dphys-swapfile

< change CONF_SWAPSIZE=1024 to CONF_SWAPSIZE=100 and save / exit nano >

sudo /etc/init.d/dphys-swapfile restart

Download the face recognition code examples:

git clone --single-branch https://github.com/ageitgey/face_recognition.git
cd ./face_recognition/examples
python3 facerec_on_raspberry_pi.py

Totally Optional: If you want a desktop GUI, install PIXEL:

sudo apt-get install --no-install-recommends xserver-xorg xinit raspberrypi-ui-mods
@tilda

This comment has been minimized.

Copy link

commented Apr 22, 2017

Additional note:

If you are installing PIXEL, you should probably up your memory split to 64. 16 will not give much responsiveness.

@samiturki

This comment has been minimized.

Copy link

commented May 10, 2017

Hi,
Although I go through all your Rpi manual installation, at the end, when i try python3 facerec_on_raspberry_pi.py, I've got:
mmal: mmal_vc_component_create: failed to create component 'vc.ril.camera' (1:ENOMEM)
mmal: mmal_component_create_core: could not create component 'vc.ril.camera' (1)
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/picamera/camera.py", line 456, in _init_camera
self._camera = mo.MMALCamera()
File "/usr/lib/python3/dist-packages/picamera/mmalobj.py", line 2279, in init
super(MMALCamera, self).init()
File "/usr/lib/python3/dist-packages/picamera/mmalobj.py", line 633, in init
prefix="Failed to create MMAL component %s" % self.component_type)
File "/usr/lib/python3/dist-packages/picamera/exc.py", line 184, in mmal_check
raise PiCameraMMALError(status, prefix)
picamera.exc.PiCameraMMALError: Failed to create MMAL component b'vc.ril.camera': Out of memory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "lib/face_recognition/examples/facerec_on_raspberry_pi.py", line 16, in
camera = picamera.PiCamera()
File "/usr/lib/python3/dist-packages/picamera/camera.py", line 431, in init
self._init_camera(camera_num, stereo_mode, stereo_decimate)
File "/usr/lib/python3/dist-packages/picamera/camera.py", line 460, in _init_camera
"Camera is not enabled. Try running 'sudo raspi-config' "
picamera.exc.PiCameraError: Camera is not enabled. Try running 'sudo raspi-config' and ensure that the camera has been enabled.

@QuentinCG

This comment has been minimized.

Copy link

commented May 10, 2017

@samiturki The error is quite clear, no?

PiCameraError: Camera is not enabled. Try running 'sudo raspi-config' and ensure that the camera has been enabled.

https://www.raspberrypi.org/learning/getting-started-with-picamera/worksheet/

@QuentinCG

This comment has been minimized.

Copy link

commented May 18, 2017

This is very very slow on my RPi3:

  • 20-30sec to initialize the facerec_on_raspberry_pi.py example <-- This is fine for me
  • 5-10sec to check each image <-- This is problematic

Is there a way to check images faster? (it is not real time at all... 1-2sec would be ok but 5-10sec is enormous)

@jyurek

This comment has been minimized.

Copy link

commented May 19, 2017

I'd love to know if there's a good way to speed this up, too.

@vchatterji

This comment has been minimized.

Copy link

commented Jun 9, 2017

@jyurek try http://vmlaker.github.io/mpipe/
Utilizing all 4 cores of the Pi via process pipelines
Plus smaller resolution of 1080p/3

@dfsdsdwe

This comment has been minimized.

Copy link

commented Jun 22, 2017

recently installed dlib with face recognition following this guide on my raspberry pi3 and when i try and run example programmes i am getting the message:
'File "face-recognition.py", line 50, in <module
import dlib
ImportError: dynamic module does not define init function (initdlib)'
any idea what is causing this? Thanks

@masoudr

This comment has been minimized.

Copy link

commented Jun 26, 2017

Thanks, @vchatterji but can you explain a little more about how to use along with face_recognition examples?

@tedm

This comment has been minimized.

Copy link

commented Jul 17, 2017

how would one add biden.jpg (which is already there) as the 'match[1]' in the example?

@roei03jen

This comment has been minimized.

Copy link

commented Jul 23, 2017

Good evening I have a problem when I install dlib v19.4: it always stop at 93% is that an error or Do i really need a really long patience thanks for the reply

@cimzar

This comment has been minimized.

Copy link

commented Jul 26, 2017

is there any way to send an output signal to one of the gpio pins on raspberrypi3 when there is a match in a picture?

@HenryCWoo

This comment has been minimized.

Copy link

commented Jul 26, 2017

@roei03jen Did you make sure to complete this step (make sure that you saved):

sudo nano /etc/dphys-swapfile

< change CONF_SWAPSIZE=100 to CONF_SWAPSIZE=1024 and save / exit nano >

sudo /etc/init.d/dphys-swapfile restart

@fumufu

This comment has been minimized.

Copy link

commented Aug 1, 2017

It's working fine on a RPi 3. I tested it successfully following the instructions above.
But it's quite slow to output the result on a RPi3, compared with the one in a VM on an Intel i5 PC.
So I am not sure if I can use the picamera to trace the face real-timely.

@CosminNechifor

This comment has been minimized.

Copy link

commented Aug 16, 2017

When I try to install face_recognition using:

sudo pip3 install face_recognition

I get this:

Exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/response.py", line 186, in read
data = self._fp.read(amt)
File "/usr/lib/python3.4/http/client.py", line 500, in read
return super(HTTPResponse, self).read(amt)
File "/usr/lib/python3.4/http/client.py", line 539, in readinto
n = self.fp.readinto(b)
File "/usr/lib/python3.4/socket.py", line 371, in readinto
return self._sock.recv_into(b)
File "/usr/lib/python3.4/ssl.py", line 745, in recv_into
return self.read(nbytes, buffer)
File "/usr/lib/python3.4/ssl.py", line 617, in read
v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 290, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python3/dist-packages/pip/req.py", line 1198, in prepare_files
do_download,
File "/usr/lib/python3/dist-packages/pip/req.py", line 1376, in unpack_url
self.session,
File "/usr/lib/python3/dist-packages/pip/download.py", line 572, in unpack_http_url
download_hash = _download_url(resp, link, temp_location)
File "/usr/lib/python3/dist-packages/pip/download.py", line 433, in _download_url
for chunk in resp_read(4096):
File "/usr/lib/python3/dist-packages/pip/download.py", line 421, in resp_read
chunk_size, decode_content=False):
File "/usr/lib/python3/dist-packages/urllib3/response.py", line 256, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "/usr/lib/python3/dist-packages/urllib3/response.py", line 201, in read
raise ReadTimeoutError(self._pool, None, 'Read timed out.')
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out.

Storing debug log for failure in /home/pi/.pip/pip.log

Can someone give me a hint?

UPDATE: it worked after I installed once again dlib

@HarveyBrezinaConniffe

This comment has been minimized.

Copy link

commented Aug 23, 2017

When I try running sudo python3 setup.py install --compiler-flags "-mpfu=neon", I get this error: error: option --compiler-flags not recognized, I also find no mention of this option in the setup.py file?

@donaldjansen

This comment has been minimized.

Copy link

commented Aug 24, 2017

has anyone got this to work on windows ?

@ghost

This comment has been minimized.

Copy link

commented Aug 26, 2017

When I try running sudo python3 setup.py install --compiler-flags "-mpfu=neon", I get this error: error: option --compiler-flags not recognized, I also find no mention of this option in the setup.py file?

@CosminNechifor

This comment has been minimized.

Copy link

commented Aug 26, 2017

Try installing dlib using:

sudo pip3 install dlib

It took me ~20 min, because I have a bad internet connection. And the face_recognition lib works fine.

@jatinkrmalik

This comment has been minimized.

Copy link

commented Aug 30, 2017

Can anyone share some benchmarks like what FPS are they able to achieve with this? And on what resolution?

@skerit

This comment has been minimized.

Copy link

commented Sep 7, 2017

The "mpfu" error is because it's a typo. It should be -mfpu=neon. F before p.

It'll compile without any problems then, but I haven't really noticed any performance boost.

@MedKarim-BALI

This comment has been minimized.

Copy link

commented Sep 13, 2017

i try with mfpu=neon and it works
error: unrecognized command line option ‘-mpfu=neon’;
did you mean
==> ‘-mfpu=neon’?

@ss6054

This comment has been minimized.

Copy link

commented Oct 14, 2017

Can it run at Raspberry Pi model B+?

@noblekoshy

This comment has been minimized.

Copy link

commented Oct 19, 2017

Would dlib benefit from VFPV3 optimization in addition to NEON?

@mecastro

This comment has been minimized.

Copy link

commented Oct 24, 2017

I'm having a problem installing the gui on raspberry pi pls help asap

@HsalF-esereveR

This comment has been minimized.

Copy link

commented Nov 9, 2017

Wondering if it can work with an USB camera ?

@osmadja

This comment has been minimized.

Copy link

commented Nov 9, 2017

Yes, it is working with usb Camera on the PI 3. I currently use a logitech c920 and it is working. But even reducing image resolution to 320x240, the performance is bad : the face detection is 3s / frame and 1.2 to compute encodings. So it is more than 4s per frame. Anyone managed better performance ? using the PI 3 gpu ?

@HsalF-esereveR

This comment has been minimized.

Copy link

commented Nov 13, 2017

@osmadja. 👍

cd ./face_recognition/examples

python3 facerec_from_webcam_faster.py

I was running this code with a USB webcam and got an error.

So I want to do a real-time face recognition (As shown in this link -> https://cloud.githubusercontent.com/assets/896692/24430398/36f0e3f0-13cb-11e7-8258-4d0c9ce1e419.gif ) with a USB webcam (Logitech QuickCam Pro 9000) that supports 1600x1200 resolution

Are you using it for real-time the same way like I do ?

@cmsfw-github

This comment has been minimized.

Copy link

commented Dec 2, 2017

Hi! When I try to run this command: sudo python3 setup.py install --compiler-flags '-mpfu=neon' on raspberrypi 3b,I get errors as follows:

Checking .pth file support in /usr/local/lib/python3.4/dist-packages/
/usr/bin/python3 -E -c pass
TEST PASSED: /usr/local/lib/python3.4/dist-packages/ appears to support .pth files
running bdist_egg
running build
Detected Python architecture: 32bit
Detected platform: linux
Removing build directory /usr/local/dlib/./tools/python/build
Configuring cmake ...
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- broken
CMake Error at /usr/share/cmake-3.0/Modules/CMakeTestCXXCompiler.cmake:54 (message):
The C++ compiler "/usr/bin/c++" is not able to compile a simple test
program.
It fails with the following output:
Change Dir: /usr/local/dlib/tools/python/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTryCompileExec3550236372/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec3550236372.dir/build.make
CMakeFiles/cmTryCompileExec3550236372.dir/build
make[1]: Entering directory
'/usr/local/dlib/tools/python/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report
/usr/local/dlib/tools/python/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building CXX object
CMakeFiles/cmTryCompileExec3550236372.dir/testCXXCompiler.cxx.o
/usr/bin/c++ -mpfu=neon -o
CMakeFiles/cmTryCompileExec3550236372.dir/testCXXCompiler.cxx.o -c
/usr/local/dlib/tools/python/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
c++: error: unrecognized command line option ‘-mpfu=neon’
CMakeFiles/cmTryCompileExec3550236372.dir/build.make:57: recipe for target
'CMakeFiles/cmTryCompileExec3550236372.dir/testCXXCompiler.cxx.o' failed
make[1]: ***
[CMakeFiles/cmTryCompileExec3550236372.dir/testCXXCompiler.cxx.o] Error 1
make[1]: Leaving directory
'/usr/local/dlib/tools/python/build/CMakeFiles/CMakeTmp'
Makefile:118: recipe for target 'cmTryCompileExec3550236372/fast' failed
make: *** [cmTryCompileExec3550236372/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
-- Configuring incomplete, errors occurred!
See also "/usr/local/dlib/tools/python/build/CMakeFiles/CMakeOutput.log".
See also "/usr/local/dlib/tools/python/build/CMakeFiles/CMakeError.log".
error: cmake configuration failed!

What should I do to correct these errors? Thank you for your reply!****

@myorulmaz

This comment has been minimized.

Copy link

commented Dec 2, 2017

RuntimeError: Error deserializing object of type short

how can i fix this error, can you help me

@Chronoculars

This comment has been minimized.

Copy link

commented Dec 4, 2017

When I run ¨sudo pip3 install face-recognition¨, I recieve this rather long error:

Exception:
Traceback (most recent call last):
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/contrib/pyopenssl.py", line 417, in wrap_socket
cnx.do_handshake()
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1426, in do_handshake
self._raise_ssl_error(self._ssl, result)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1149, in _raise_ssl_error
raise WantReadError()
OpenSSL.SSL.WantReadError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 350, in _make_request
self._validate_conn(conn)
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 837, in validate_conn
conn.connect()
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connection.py", line 323, in connect
ssl_context=context)
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/util/ssl
.py", line 324, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/contrib/pyopenssl.py", line 421, in wrap_socket
raise timeout('select timed out')
socket.timeout: select timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 594, in urlopen
chunked=chunked)
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 353, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=conn.timeout)
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 313, in _raise_timeout
raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='www.piwheels.hostedpi.com', port=443): Read timed out. (read timeout=15)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 353, in run
wb.build(autobuilding=True)
File "/usr/lib/python3/dist-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 554, in _prepare_file
require_hashes
File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/usr/lib/python3/dist-packages/pip/index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/usr/lib/python3/dist-packages/pip/index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/usr/lib/python3/dist-packages/pip/index.py", line 568, in _get_pages
page = self._get_page(location)
File "/usr/lib/python3/dist-packages/pip/index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/usr/lib/python3/dist-packages/pip/index.py", line 792, in get_page
"Cache-Control": "max-age=600",
File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 501, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python3/dist-packages/pip/download.py", line 386, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 488, in request
resp = self.send(prep, **send_kwargs)
File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 609, in send
r = adapter.send(request, **kwargs)
File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/adapter.py", line 47, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/adapters.py", line 423, in send
timeout=timeout
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 643, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 315, in increment
total -= 1
TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'

Does anyone know how to fix this?
Thanks!

@melvudin

This comment has been minimized.

Copy link

commented Dec 9, 2017

@cmsfw-github
Use -mfpu instead of -mpfu

@cmsfw-github

This comment has been minimized.

Copy link

commented Dec 12, 2017

@melvudin
Thank you! I‘ve solved this problem successfully!

@ageitgey

This comment has been minimized.

Copy link
Owner Author

commented Dec 13, 2017

@melvudin doh typo, thanks!

@Alex-Ladron

This comment has been minimized.

Copy link

commented Dec 13, 2017

After installing and running on "(cv)" to access the webcam, I keep getting the following error:

File "facerec_from_webcam.py", line 15, in
obama_image = face_recognition.load_image_file("obama.jpg")
AttributeError: module 'face_recognition' has no attribute 'load_image_file'

Appreciate any help! Thank you!

@kkeyan

This comment has been minimized.

Copy link

commented Jan 14, 2018

ImportError: No module named face_recognition on raspberry pi

@vrushang25

This comment has been minimized.

Copy link

commented Jan 18, 2018

how to install it for python 2.7 in raspberry pi 3-B?

@liguilini

This comment has been minimized.

Copy link

commented Jan 20, 2018

Hi! When I try to run python3 ./face_recognition/examples/facerec_on_raspberry_pi.py I get exception occurred. how to fix it?
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/numpy/core/init.py", line 16, in
from . import multiarray
ImportError: libf77blas.so.3: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "./Documents/facerecognition/face_recognition/examples/facerec_on_raspberry_pi.py", line 9, in
import face_recognition
File "/usr/local/lib/python3.5/dist-packages/face_recognition/init.py", line 7, in
from .api import load_image_file, face_locations, batch_face_locations, face_landmarks, face_encodings, compare_faces, face_distance
File "/usr/local/lib/python3.5/dist-packages/face_recognition/api.py", line 3, in
import scipy.misc
File "/usr/local/lib/python3.5/dist-packages/scipy/init.py", line 61, in
from numpy import show_config as show_numpy_config
File "/usr/local/lib/python3.5/dist-packages/numpy/init.py", line 142, in
from . import add_newdocs
File "/usr/local/lib/python3.5/dist-packages/numpy/add_newdocs.py", line 13, in
from numpy.lib import add_newdoc
File "/usr/local/lib/python3.5/dist-packages/numpy/lib/init.py", line 8, in
from .type_check import *
File "/usr/local/lib/python3.5/dist-packages/numpy/lib/type_check.py", line 11, in
import numpy.core.numeric as _nx
File "/usr/local/lib/python3.5/dist-packages/numpy/core/init.py", line 26, in
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try git clean -xdf (removes all
files not under version control). Otherwise reinstall numpy.

Original error was: libf77blas.so.3: cannot open shared object file: No such file or directory

@EnglishAlex

This comment has been minimized.

Copy link

commented Jan 21, 2018

I ran sudo apt-get clean and git clean -xdf it didn't help.
I searched for errors related to libf77blas.so.3 - found one reference to installing another library.. I ran sudo apt-get install libatlas-base-dev and this fixed the "Original error was: libf77blas.so.3: cannot open shared object file: No such file or directory" error.

@liguilini

This comment has been minimized.

Copy link

commented Jan 22, 2018

@EnglishAlex Thank you.I run sudo apt-get install libatlas but it didn't help.When i run sudo apt-get install libatlas-base-dev.I‘ve solved this problem successfully.

@mthd98

This comment has been minimized.

Copy link

commented Feb 4, 2018

hi i need help when i import face_recognition it give me this error
Traceback (most recent call last):
File "<pyshell#0>", line 1, in
import face_recognition
File "/usr/local/lib/python3.5/dist-packages/face_recognition/init.py", line 7, in
from .api import load_image_file, face_locations, batch_face_locations, face_landmarks, face_encodings, compare_faces, face_distance
File "/usr/local/lib/python3.5/dist-packages/face_recognition/api.py", line 4, in
import dlib
ImportError: libatlas.so.3: cannot open shared object file: No such file or directory

@superleggera24

This comment has been minimized.

Copy link

commented Feb 13, 2018

After 24 hours following this tutorial I finally got it working. I got errors from numpy, int64 errors and so on. What did it for me, was this:

  1. After downloading a recent raspbian img, instantly updating python to 3.6
  2. From then on every command with python3 in it, you should use python3.6 instead
  3. Then there is dlib. This tutorial uses 19.6 in the example codes, but the setup.py requirements say >= 19.7. This means your freshly installed dlib is instantly removed. Yes, I know. It took very long for me too. The first command you should change 19.6 to 19.9.
  4. Also very important: dont use pip3, but use pip3.6

I hope this helped any of you, I know it sure did help me.

@sylveryte

This comment has been minimized.

Copy link

commented Feb 19, 2018

@superleggera24
Thank you, It helped, I sucessfully installed face_recognition on raspbian lite. With "python3.6 -m pip ...". I installed both dlib and face_recognition with pip. It takes a lot of time around 2-3 hours for all modules[dlib,scipy,numpy,pillow,click,face_recognition.

@wljgithub

This comment has been minimized.

Copy link

commented Mar 5, 2018

thanks,i occur the same error :
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try git clean -xdf (removes all
files not under version control). Otherwise reinstall numpy.
fortunately,I fix it after i ran " sudo apt-get install libatlas-base-dev "
thank you very much,guys

@IarveJ

This comment has been minimized.

Copy link

commented Mar 8, 2018

So Im trying to install this on a relatively new board the PYNQ board by Xilinx. Using these same instructions it is possible, however the install takes a very long time to :
Running setup.py install for dlib ...

Is this normal and should be expected?

@mostafazaghlol

This comment has been minimized.

Copy link

commented Mar 12, 2018

I face a problem with this Line

``sudo python3 setup.py install --compiler-flags "-mfpu=neon"

It take from 4 to 6 hour to finish and when it reach 98 % it stopped with error ? is there any second choose ?

@diegozaks

This comment has been minimized.

Copy link

commented Mar 19, 2018

Been about 16 hours, on 96% on a RPi Zero W... Waiting, this is my 5th attempt.
Had to use
< change CONF_SWAPSIZE=100 to CONF_SWAPSIZE=512 and save / exit nano >

since 1024 would just error "ran out of memory" at around 40%. Probably because the Zero has only 512mb of ram.

Will update if it works this time. I've already ordered a Pi3 B+, looking forward to that one if this does not work.

Update: build failed at 96%, ran out of memory.

Update 2: completed build
Tried again, make sure GPU memory split is set to 16, not 64"
Got it working, has to reinstall numpy afterward since I was getting this error.
libf77blas.so.3: cannot open shared object file: No such file or directory

It now works. The Pi Zero is as slow as advertised. The "find_faces_in_picture.py" takes about 60 seconds. Looking at ways to optimize while my Pi 3 B+ arrives.

@vinitvilla

This comment has been minimized.

Copy link

commented Mar 21, 2018

I face some problems when doing this operation: (python3 facerec_on_raspberry_pi.py)

Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/numpy/core/init.py", line 16, in
from . import multiarray
ImportError: libf77blas.so.3: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "facerec_on_raspberry_pi.py", line 9, in
import face_recognition
File "/usr/local/lib/python3.5/dist-packages/face_recognition/init.py", line 7, in
from .api import load_image_file, face_locations, batch_face_locations, face_landmarks, face_encodings, compare_faces, face_distance
File "/usr/local/lib/python3.5/dist-packages/face_recognition/api.py", line 3, in
import scipy.misc
File "/usr/local/lib/python3.5/dist-packages/scipy/init.py", line 61, in
from numpy import show_config as show_numpy_config
File "/usr/local/lib/python3.5/dist-packages/numpy/init.py", line 142, in
from . import add_newdocs
File "/usr/local/lib/python3.5/dist-packages/numpy/add_newdocs.py", line 13, in
from numpy.lib import add_newdoc
File "/usr/local/lib/python3.5/dist-packages/numpy/lib/init.py", line 8, in
from .type_check import *
File "/usr/local/lib/python3.5/dist-packages/numpy/lib/type_check.py", line 11, in
import numpy.core.numeric as _nx
File "/usr/local/lib/python3.5/dist-packages/numpy/core/init.py", line 26, in
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try git clean -xdf (removes all
files not under version control). Otherwise reinstall numpy.

Original error was: libf77blas.so.3: cannot open shared object file: No such file or directory

KINDLY HELP

@neutralvibes

This comment has been minimized.

Copy link

commented Apr 20, 2018

For those looking to improve performance you need to install OpenBlas before compiling dlib. It does make things a bit faster if you do.

To install OpenBLAS

sudo apt-get install libopenblas-dev liblapack-dev libatlas-base-dev

Important

As I found out painfully, OpenBLAS does help, but it will chew up your cores and cause days of head banging if you don't set the following environment variables in your shell before running any recognition.

export OPENBLAS_NUM_THREADS=1 
export OPENBLAS_MAIN_FREE=1

May the force be with you

@boomza19193

This comment has been minimized.

Copy link

commented Apr 23, 2018

pi@raspberrypi:~ $ git clone -b 'v19.6' --single-branch https://github.com/davisking/dlib.git dlib/
Cloning into 'dlib'...
fatal: unable to access 'https://github.com/davisking/dlib.git/': GnuTLS recv error (-54): Error in the pull function.

How i solve this problem?

@netrosec

This comment has been minimized.

Copy link

commented May 10, 2018

Help!! Face_Recognition does not download successfully on my pi 3b. It downloads half way then spits out some errors in red that are too large to paste here. I have dlib installed already. Anyone encountered the same problem downloading the api?

@Oliverredtree

This comment has been minimized.

Copy link

commented May 20, 2018

Hi,guys.when I run python3 facerec_on_raspberry_pi.py , I get exception occurred. how to fix it?

Loading known face image(s)
Traceback (most recent call last):
File "facerec_on_raspberry_pi.py", line 24, in
obama_face_encoding = face_recognition.face_encodings(obama_image)[0]
File "/home/pi/.local/lib/python3.5/site-packages/face_recognition/api.py", line 200, in face_encodings
return [np.array(face_encoder.compute_face_descriptor(face_image, raw_landmark_set, num_jitters)) for raw_landmark_set in raw_landmarks]
File "/home/pi/.local/lib/python3.5/site-packages/face_recognition/api.py", line 200, in
return [np.array(face_encoder.compute_face_descriptor(face_image, raw_landmark_set, num_jitters)) for raw_landmark_set in raw_landmarks]
RuntimeError: The full_object_detection must use the iBUG 300W 68 point face landmark style.

@MaulyGabriel

This comment has been minimized.

Copy link

commented May 28, 2018

I had a problem after the installation, when I run the examples of the segmentation fault

@PauloCirino

This comment has been minimized.

Copy link

commented May 28, 2018

I'm having a weird problem.
I did just like superleggera24 said so, and installed the dlib 19.9;
Installed the OpenBLAS stuff ...
And Everything compiled the way it was supposed to.

Tested the face_recognition.face_locations function and it took, on average, 0.7 seconds.
But the face_recognition.face_encodings function runs forever(I waited 20 minutes before rebooting).
I tried changing the memory split, but it didn't work.
And this entire time, all 4 cores of the raspberry are working 100%.
Don't know what that might be, I'm going to try to reinstall everything and see if I made any mistakes on the way.

image

So i found what was the problem, and it is with the dlib.face_recognition_model_v1 function ....
Long story short, this guy had the same problem and provided a fix (davisking/dlib#660).

@alijaddoa

This comment has been minimized.

Copy link

commented Jul 3, 2018

Dear thank you for that,
i have installed all the packages, but when i try to run on of the example, an error it' occurring which is
"
Traceback (most recent call last):
File "face_distance.py", line 1, in
import face_recognition
ImportError: No module named face_recognition

"

can you please help with that
thank you

@srs123

This comment has been minimized.

Copy link

commented Jul 9, 2018

how to install cv2 in raspberry pi 3 ?
i install raspberry jessie os cv2 install and face recongnition refere code link

@gschrago

This comment has been minimized.

Copy link

commented Jul 11, 2018

Hi,
I have the following error while testing the fresh installation:

pi@pi-cam1:~/dlib/face_recognition/examples $ python3 facerec_on_raspberry_pi.py
Traceback (most recent call last):
File "facerec_on_raspberry_pi.py", line 9, in
import face_recognition
File "/usr/local/lib/python3.5/dist-packages/face_recognition/init.py", line 7, in
from .api import load_image_file, face_locations, batch_face_locations, face_landmarks, face_encodings, compare_faces, face_distance
File "/usr/local/lib/python3.5/dist-packages/face_recognition/api.py", line 4, in
import dlib
ImportError: libatlas.so.3: cannot open shared object file: No such file or directory

Could you please kindly advise.
Thanks and best regards.
Gerard Schrago.

@ZT-XU

This comment has been minimized.

Copy link

commented Jul 27, 2018

I run the example and I get this:
python3 facerec_on_raspberry_pi.py
Loading known face image(s)
Capturing image.
Traceback (most recent call last):
File "facerec_on_raspberry_pi.py", line 33, in
camera.capture(output, format="rgb",use_video_port=True)
File "/usr/lib/python3/dist-packages/picamera/camera.py", line 1423, in capture
'Timed out waiting for capture to end')
picamera.exc.PiCameraRuntimeError: Timed out waiting for capture to end
can't anyone help me?

@chn-lee-yumi

This comment has been minimized.

Copy link

commented Jul 27, 2018

When I installing dlib, I found that it's unnecesary to change the size of swapfile. During the installation, the max usage of swap is less than 10MB. So the default settings(100MB) is OK.
My model is Raspberry Pi 2B, 1G RAM.
By the way, I change the GPU memory to 8MB, it still runs well.
After all is complete, I try python3 face_distance.py, it throws out an error about libatlas.so.3, so I use this command to fix it:sudo apt-get install libatlas3-base.( I see a lot of people meet this error.)
@gschrago @mthd98

@tutaf

This comment has been minimized.

Copy link

commented Aug 4, 2018

Is this instruction for camera connected through CSI or usb too?

@cqupi

This comment has been minimized.

Copy link

commented Aug 12, 2018

@chn-lee-yumi Nice man!困扰我一下午问题被你一句话解决,你是怎么做到的!

@gschrago

This comment has been minimized.

Copy link

commented Sep 29, 2018

When I installing dlib, I found that it's unnecesary to change the size of swapfile. During the installation, the max usage of swap is less than 10MB. So the default settings(100MB) is OK.
My model is Raspberry Pi 2B, 1G RAM.
By the way, I change the GPU memory to 8MB, it still runs well.
After all is complete, I try python3 face_distance.py, it throws out an error about libatlas.so.3, so I use this command to fix it:sudo apt-get install libatlas3-base.( I see a lot of people meet this error.)
@gschrago @mthd98
Thanks to Yumi Lee, this has fully addressed the issue.

@adv-ai-tech

This comment has been minimized.

Copy link

commented Oct 3, 2018

Thanks a lot @chn-lee-yumi

@Demo233

This comment has been minimized.

Copy link

commented Oct 8, 2018

pretty cool!

@nishthachhabra

This comment has been minimized.

Copy link

commented Oct 15, 2018

I have installed every required library and no such error or warning was encountered by the time but when i run the code, it showed some error.
please guide me, to resolve it. Error mentioned below -

Taking image...
image captured, resized and renamed successfully
OpenCV(3.4.1) Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvDestroyAllWindows, file /home/pi/opencv-3.4.1/modules/highgui/src/window.cpp, line 630
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python3.5/tkinter/init.py", line 1562, in call
return self.func(*args)
File "test.py", line 59, in enter_the_value
cv2.destroyAllWindows()
cv2.error: OpenCV(3.4.1) /home/pi/opencv-3.4.1/modules/highgui/src/window.cpp:630: error: (-2) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function cvDestroyAllWindows

revert ASAP.

@xgarb

This comment has been minimized.

Copy link

commented Oct 28, 2018

I have this running on a Pi Zero W with the Pi ZeroCam. It's not fast but it does work well.

I've created an installation walkthrough on my blog following the guide and comments above: https://robotzero.one/face-recognition-party-greeter-raspberry-pi/

If you want to test a complete install the blog links to an img file with everything installed that you can flash to a microSD card with Etcher.

You can see how fast it runs with the 'Obama' example on the test script in the guide on YouTube here: https://youtu.be/2qDCxVRbge0?t=532 Or if you have 15 minutes - face recognition, Bluetooth connection and speech synthesis: https://youtu.be/2qDCxVRbge0

@Priyadarshanvijay

This comment has been minimized.

Copy link

commented Nov 15, 2018

Please help me out, when I'm trying to run facerec_on_raspberry_pi.py it gives out the following message :
Traceback (most recent call last):
File "./face_recognition/examples/facerec_on_raspberry_pi.py", line 9, in
import face_recognition
ImportError: No module named 'face_recognition'

Can anyone please guide me on how to solve this?

@hazxone

This comment has been minimized.

Copy link

commented Dec 5, 2018

add this is you are using opencv:

sudo apt install libjasper-dev
sudo apt install libilmbase-dev
sudo apt install libopenexr-dev
sudo apt install libgstreamer1.0-dev 
sudo apt install libavcodec-dev
sudo apt install libavformat-dev
sudo apt install libswscale-dev
sudo apt install libgtk-3-dev
sudo apt install libqt4-dev

@cena001plus

This comment has been minimized.

Copy link

commented Jan 2, 2019

Careful installation of PIXEL GUI, the result is often stuck, you need to format the TF card, and then you need to re-install.

@cena001plus

This comment has been minimized.

Copy link

commented Jan 3, 2019

After the installation is completed step by step, the prompt is: “picamera.exc.piCameraError: camera is not enabled. ” but through sudo raspi-confgi, the camera has been enabled , and detect support = 1, dectected = 0, where is the problem?

@aperalta1437

This comment has been minimized.

Copy link

commented Jan 11, 2019

On which Pi does this performs better? And how much memory it should have?

@nicofirst1

This comment has been minimized.

Copy link

commented Feb 20, 2019

Hello, after completing the installation i get the following error when executing python facerec_on_raspberry_pi.py

Traceback (most recent call last):
  File "facerec_on_raspberry_pi.py", line 9, in <module>
    import face_recognition
  File "/home/pi/Work/MotionBot/motion/lib/python3.6/site-packages/face_recognition/__init__.py", line 7, in <module>
    from .api import load_image_file, face_locations, batch_face_locations, face_landmarks, face_encodings, compare_faces, face_distance
  File "/home/pi/Work/MotionBot/motion/lib/python3.6/site-packages/face_recognition/api.py", line 4, in <module>
    import dlib
ImportError: /lib/arm-linux-gnueabihf/libm.so.6: version `GLIBC_2.27' not found (required by /home/pi/Work/MotionBot/motion/lib/python3.6/site-packages/dlib.cpython-36m-arm-linux-gnueabihf.so)

I tried to update lib6 with sudo apt-get install libc6 and recompile but the error is still there.

Can anyone help me?

@krunalpuri

This comment has been minimized.

Copy link

commented Apr 10, 2019

I followed these steps on raspi1 and I'm getting this error:

>>> import face_recognition                                                                                                                                                                                        
Traceback (most recent call last):                                                                                                                                                                                 
  File "<stdin>", line 1, in <module>                                                                                                                                                                              
  File "/usr/local/lib/python3.5/dist-packages/face_recognition/__init__.py", line 7, in <module>                                                                                                                  
    from .api import load_image_file, face_locations, batch_face_locations, face_landmarks, face_encodings, compare_faces, face_distance                                                                           
  File "/usr/local/lib/python3.5/dist-packages/face_recognition/api.py", line 14, in <module>                                                                                                                      
    face_detector = dlib.get_frontal_face_detector()                                                                                                                                                               
AttributeError: module 'dlib' has no attribute 'get_frontal_face_detector'                                                                                                                                         
>>>          

Any suggestions,please ?

@chenguangPKU

This comment has been minimized.

Copy link

commented Apr 15, 2019

Face_Recognition does not download successfully on my pi 3b. It downloads half way then spits out some errors in red. I have dlib installed already. Any suggestions ,please?

@edoaxyz

This comment has been minimized.

Copy link

commented Jun 9, 2019

Note that the version of dlib that this guide makes you compile is 19.6 while face_recognition needs 19.3.0, so at the end you compile dlib twice. Actually, the version of face_recognition that pip makes you download and install on last version of Raspbian requires 19.7 which is still newer than 19.6.
You can change the version when you download the dlib library through git specifying the correct branch.

@harshatejas

This comment has been minimized.

Copy link

commented Jun 24, 2019

Hi sir, When i tried installing face_recognition library on raspberry pi 3 B+
I am facing a error.
ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
face-recognition-models>=0.3.0 from https://www.piwheels.org/simple/face-recognition-models/face_recognition_models-0.3.0-py2.py3-none-any.whl#sha256=8d6b0af2e37a17120c3f13107974bc252142a4ffcb4e58eabdfcf26608e52c24 (from face_recognition):
Expected sha256 8d6b0af2e37a17120c3f13107974bc252142a4ffcb4e58eabdfcf26608e52c24
Got 258ea7294da50fcee11b089baecff3d3703b77aadb72dd4eb58d0cd365a255ae

@jtreg

This comment has been minimized.

Copy link

commented Jun 26, 2019

I used this advice and highly commend your method thanks (after a lot of faffing around elsewhere!) See my blog at https://tregaskis.net/artefact-with-face-recognition-with-raspberry-pi-camera/

@dewbus

This comment has been minimized.

Copy link

commented Jul 1, 2019

Would anyone recommend this for simple object detection? Or is the built in library only able to be trained for facial features?

@edoaxyz

This comment has been minimized.

Copy link

commented Jul 3, 2019

It is designed to do face recognition so it tries to find the facial features in every image. Maybe you can use it for what you want but surely you won't get the results expected most of times

@cpflum

This comment has been minimized.

Copy link

commented Jul 5, 2019

@harshatejas- did you have any luck? I'm running into the same issue- it gets to the point it is 10-15% complete downloading the face recognition models from pinwheels.org and then I get the THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE.

If anybody has any tips, please let me know

@ivanovd

This comment has been minimized.

Copy link

commented Jul 8, 2019

Same error here as well:

sudo pip3 install face_recognition
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting face_recognition
  Downloading https://files.pythonhosted.org/packages/3f/ed/ad9a28042f373d4633fc8b49109b623597d6f193d3bbbef7780a5ee8eef2/face_recognition-1.2.3-py2.py3-none-any.whl
Collecting face-recognition-models>=0.3.0 (from face_recognition)
  Downloading https://www.piwheels.org/simple/face-recognition-models/face_recognition_models-0.3.0-py2.py3-none-any.whl (100.6MB)
     |████████▉                       | 27.8MB 6.3MB/s eta 0:00:12
Requirement already satisfied: Click>=6.0 in /usr/lib/python3/dist-packages (from face_recognition) (6.6)
Requirement already satisfied: Pillow in /usr/lib/python3/dist-packages (from face_recognition) (4.0.0)
Collecting dlib>=19.7 (from face_recognition)
  Downloading https://files.pythonhosted.org/packages/05/57/e8a8caa3c89a27f80bc78da39c423e2553f482a3705adc619176a3a24b36/dlib-19.17.0.tar.gz (3.4MB)
     |████████████████████████████████| 3.4MB 2.2MB/s
Requirement already satisfied: numpy in /usr/lib/python3/dist-packages (from face_recognition) (1.12.1)
ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
    face-recognition-models>=0.3.0 from https://www.piwheels.org/simple/face-recognition-models/face_recognition_models-0.3.0-py2.py3-none-any.whl#sha256=8d6b0af2e37a17120c3f13107974bc252142a4ffcb4e58eabdfcf26608e52c24 (from face_recognition):
        Expected sha256 8d6b0af2e37a17120c3f13107974bc252142a4ffcb4e58eabdfcf26608e52c24
             Got        32e569dd8706c7b501e0c8a6120c922c26d80c9b9eb5df38c658d2470862f7be

I tried --no-cache-dir option but no luck

@warwere

This comment has been minimized.

Copy link

commented Jul 27, 2019

Even after running --no-cahe-dir face_recognition I get this error

sudo pip3 install --no-cache-dir face_recognition
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting face_recognition
Downloading https://files.pythonhosted.org/packages/3f/ed/ad9a28042f373d4633fc8b49109b623597d6f193d3bbbef7780a5ee8eef2/face_recognition-1.2.3-py2.py3-none-any.whl
Requirement already satisfied: Pillow in /usr/lib/python3/dist-packages (from face_recognition) (5.4.1)
Requirement already satisfied: numpy in /usr/lib/python3/dist-packages (from face_recognition) (1.16.2)
Requirement already satisfied: Click>=6.0 in /usr/lib/python3/dist-packages (from face_recognition) (7.0)
Collecting face-recognition-models>=0.3.0 (from face_recognition)
Downloading https://www.piwheels.org/simple/face-recognition-models/face_recognition_models-0.3.0-py2.py3-none-any.whl (100.6MB)
|█ | 2.9MB 14kB/s eta 1:50:54ERROR: Exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 304, in recv_into
return self.connection.recv_into(*args, **kwargs)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1822, in recv_into
self._raise_ssl_error(self._ssl, result)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1622, in _raise_ssl_error
raise WantReadError()
OpenSSL.SSL.WantReadError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 304, in recv_into
return self.connection.recv_into(*args, **kwargs)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1822, in recv_into
self._raise_ssl_error(self._ssl, result)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1622, in _raise_ssl_error
raise WantReadError()
OpenSSL.SSL.WantReadError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 304, in recv_into
return self.connection.recv_into(*args, **kwargs)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1822, in recv_into
self._raise_ssl_error(self._ssl, result)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1622, in _raise_ssl_error
raise WantReadError()
OpenSSL.SSL.WantReadError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 304, in recv_into
return self.connection.recv_into(*args, **kwargs)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1822, in recv_into
self._raise_ssl_error(self._ssl, result)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1622, in _raise_ssl_error
raise WantReadError()
OpenSSL.SSL.WantReadError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 304, in recv_into
return self.connection.recv_into(*args, **kwargs)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1822, in recv_into
self._raise_ssl_error(self._ssl, result)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1622, in _raise_ssl_error
raise WantReadError()
OpenSSL.SSL.WantReadError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 304, in recv_into
return self.connection.recv_into(*args, **kwargs)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1822, in recv_into
self._raise_ssl_error(self._ssl, result)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1622, in _raise_ssl_error
raise WantReadError()
OpenSSL.SSL.WantReadError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 304, in recv_into
return self.connection.recv_into(*args, **kwargs)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1822, in recv_into
self._raise_ssl_error(self._ssl, result)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1622, in _raise_ssl_error
raise WantReadError()
OpenSSL.SSL.WantReadError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 304, in recv_into
return self.connection.recv_into(*args, **kwargs)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1822, in recv_into
self._raise_ssl_error(self._ssl, result)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1639, in _raise_ssl_error
raise SysCallError(errno, errorcode.get(errno))
OpenSSL.SSL.SysCallError: (104, 'ECONNRESET')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/urllib3/response.py", line 397, in _error_catcher
yield
File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/urllib3/response.py", line 479, in read
data = self._fp.read(amt)
File "/usr/lib/python3.7/http/client.py", line 447, in read
n = self.readinto(b)
File "/usr/lib/python3.7/http/client.py", line 491, in readinto
n = self.fp.readinto(b)
File "/usr/lib/python3.7/socket.py", line 589, in readinto
return self._sock.recv_into(b)
File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 319, in recv_into
return self.recv_into(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 319, in recv_into
return self.recv_into(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 319, in recv_into
return self.recv_into(*args, **kwargs)
[Previous line repeated 4 more times]
File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 309, in recv_into
raise SocketError(str(e))
OSError: (104, 'ECONNRESET')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/base_command.py", line 188, in main
status = self.run(options, args)
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/commands/install.py", line 345, in run
resolver.resolve(requirement_set)
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/legacy_resolve.py", line 196, in resolve
self._resolve_one(requirement_set, req)
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/legacy_resolve.py", line 359, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/legacy_resolve.py", line 307, in _get_abstract_dist_for
self.require_hashes
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/operations/prepare.py", line 199, in prepare_linked_requirement
progress_bar=self.progress_bar
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/download.py", line 1050, in unpack_url
progress_bar=progress_bar
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/download.py", line 910, in unpack_http_url
progress_bar)
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/download.py", line 1138, in _download_http_url
_download_url(resp, link, content_file, hashes, progress_bar)
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/download.py", line 847, in _download_url
hashes.check_against_chunks(downloaded_chunks)
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/utils/hashes.py", line 75, in check_against_chunks
for chunk in chunks:
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/download.py", line 815, in written_chunks
for chunk in chunks:
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/utils/ui.py", line 156, in iter
for x in it:
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/download.py", line 804, in resp_read
decode_content=False):
File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/urllib3/response.py", line 531, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/urllib3/response.py", line 496, in read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File "/usr/lib/python3.7/contextlib.py", line 130, in exit
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/urllib3/response.py", line 415, in _error_catcher
raise ProtocolError('Connection broken: %r' % e, e)
pip._vendor.urllib3.exceptions.ProtocolError: ('Connection broken: OSError("(104, 'ECONNRESET')")', OSError("(104, 'ECONNRESET')"))

@Bonzadog

This comment has been minimized.

Copy link

commented Aug 1, 2019

Is this still relevant in August 2019?

@cpflum

This comment has been minimized.

Copy link

commented Aug 1, 2019

Like, did it become irrelevant on July 31st?

I was never able to have success installing all of the packages for this app. Rather than continuing down that path, I've gotten facial recognition up and running using an LBPH model with Open CV and NumPy on my Pi. It's not quite as robust as this one yet, but it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.