Dlib: setup.py: subprocess command cmake returned non-zero exit status 2

Created on 24 Oct 2018  路  4Comments  路  Source: davisking/dlib

Expected Behavior

I'm just trying to install amazing dlib on my Ubuntu server following this guide.

Current Behavior

The command python3 setup.py install leads to the following error:

running install
Checking .pth file support in /usr/local/lib/python3.5/dist-packages/
/usr/bin/python3 -E -c pass
TEST PASSED: /usr/local/lib/python3.5/dist-packages/ appears to support .pth files
running bdist_egg
running egg_info
writing dlib.egg-info/PKG-INFO
writing dependency_links to dlib.egg-info/dependency_links.txt
writing top-level names to dlib.egg-info/top_level.txt
package init file 'dlib/__init__.py' not found (or not a regular file)
reading manifest file 'dlib.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'dlib.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
Building extension for Python 3.5.2 (default, Nov 23 2017, 16:37:01) 
Invoking CMake setup: 'cmake /aivanf/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/aivanf/dlib/build/lib.linux-x86_64-3.5 -DPYTHON_EXECUTABLE=/usr/bin/python3 -DCMAKE_BUILD_TYPE=Release'
-- pybind11 v2.2.2
-- Using CMake version: 3.5.1
-- Compiling dlib version: 19.16.99
-- SSE4 instructions can be executed by the host processor.
-- AVX instructions can be executed by the host processor.
-- Enabling AVX instructions
-- C++11 activated.
-- Configuring done
-- Generating done
-- Build files have been written to: /aivanf/dlib/build/temp.linux-x86_64-3.5
Invoking CMake build: 'cmake --build . --config Release -- -j1'
[ 82%] Built target dlib
[ 83%] Building CXX object CMakeFiles/dlib_python.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_python.dir/build.make:350: recipe for target 'CMakeFiles/dlib_python.dir/src/image2.cpp.o' failed
make[2]: *** [CMakeFiles/dlib_python.dir/src/image2.cpp.o] Error 4
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/dlib_python.dir/all' failed
make[1]: *** [CMakeFiles/dlib_python.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
Traceback (most recent call last):
  File "setup.py", line 257, in <module>
    'Topic :: Software Development',
  File "/usr/lib/python3.5/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.5/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 67, in run
    self.do_egg_install()
  File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 109, in do_egg_install
    self.run_command('bdist_egg')
  File "/usr/lib/python3.5/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 161, in run
    cmd = self.call_command('install_lib', warn_dir=0)
  File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 147, in call_command
    self.run_command(cmdname)
  File "/usr/lib/python3.5/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/usr/lib/python3/dist-packages/setuptools/command/install_lib.py", line 23, in run
    self.build()
  File "/usr/lib/python3.5/distutils/command/install_lib.py", line 109, in build
    self.run_command('build_ext')
  File "/usr/lib/python3.5/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "setup.py", line 133, in run
    self.build_extension(ext)
  File "setup.py", line 173, in build_extension
    subprocess.check_call(cmake_build, cwd=build_folder)
  File "/usr/lib/python3.5/subprocess.py", line 581, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j1']' returned non-zero exit status 2

After first seeing the error I googled it a lot, but found nothing helpful. I updated GCC, G++ to the version 7.3, but this didn't solved the problem.

Steps to Reproduce

git clone https://github.com/davisking/dlib.git
python3 setup.py install
  • Version: I used this GitHub repo, so I believe it is the last version (but I don't see the number).
  • Platform: Ubuntu 16.04 LTS (GNU/Linux 2.6.32-042stab134.3 x86_64)
  • GCC/G++: 7.3.0
  • CMake: 3.5.1
  • Python: 3.5.2

Most helpful comment

You are probably running out of RAM.

All 4 comments

The problem is even more strange because a few days ago I successfully installed dlib on another Ubuntu server which has all the same versions of GCC, G++, CMake, Python3. However this one I bought many months ago and it has lots of other software, meanwhile the problematic server was bought several hours ago and has no other soft. Also, that Ubuntu has other version: 16.04.3 LTS (GNU/Linux 4.4.0-21-generic x86_64)

You are probably running out of RAM.

You are probably running out of RAM.

Thanks for your soon reply! Indeed, previous time I used a swap file to workaround this problem. However, it was googled easily, not like this time. Probably you should add a big note about enough RAM :D

You are probably running out of RAM.

I was doing python setup.py install in a container on Mac and increasing Memory/Swap of Docker fixed the issue. Although I went a bit over the top.

Docker Defaults:
Memory: 2GB
Swap: 1GB

Worked with:
Memory: 11GB
Swap: 3GB

Pretty sure it doesn't require that much allocation.

Was this page helpful?
0 / 5 - 0 ratings