Pip3 install face_recognition fails

While installing face_recognition module, I am getting an error “c++: internal compiler error: Killed (program cc1plus)”
I am seeing the following error:

Scanning dependencies of target _dlib_pybind11
[ 80%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/dlib.cpp.o
[ 80%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/matrix.cpp.o
[ 81%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/vector.cpp.o
[ 82%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/svm_c_trainer.cpp.o
[ 83%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/svm_rank_trainer.cpp.o
[ 83%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/decision_functions.cpp.o
[ 84%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/other.cpp.o
[ 85%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/basic.cpp.o
[ 86%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/cca.cpp.o
[ 87%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/sequence_segmenter.cpp.o
[ 87%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/svm_struct.cpp.o
[ 88%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/image.cpp.o
[ 89%] Building CXX object CMakeFiles/_dlib_pybind11.dir/src/image2.cpp.o
c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.
CMakeFiles/_dlib_pybind11.dir/build.make:326: recipe for target 'CMakeFiles/_dlib_pybind11.dir/src/image.cpp.o' failed
make[2]: *** [CMakeFiles/_dlib_pybind11.dir/src/image.cpp.o] Error 4
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/_dlib_pybind11.dir/all' failed
make[1]: *** [CMakeFiles/_dlib_pybind11.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-build-8x146ayc/dlib/setup.py", line 262, in <module>
    'Topic :: Software Development',
  File "/home/satish/.local/lib/python3.6/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/home/satish/.local/lib/python3.6/site-packages/setuptools/command/install.py", line 61, in run
    return orig.install.run(self)
  File "/usr/lib/python3.6/distutils/command/install.py", line 589, in run
    self.run_command('build')
  File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/usr/lib/python3.6/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/tmp/pip-build-8x146ayc/dlib/setup.py", line 135, in run
    self.build_extension(ext)
  File "/tmp/pip-build-8x146ayc/dlib/setup.py", line 175, in build_extension
    subprocess.check_call(cmake_build, cwd=build_folder)
  File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j2']' returned non-zero exit status 2.

----------------------------------------

Command “/usr/bin/python3 -u -c “import setuptools, tokenize;file=’/tmp/pip-build-8x146ayc/dlib/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-32h1maiw-record/install-record.txt --single-version-externally-managed --compile --user --prefix=” failed with error code 1 in /tmp/pip-build-8x146ayc/dlib/

Hi,

“Killed” is usually caused by running out of memory.
Could you monitor your device with tegrastats at the same time to confirm if this is the cause?

Thanks.