I’m having trouble installing dlib on a centos7 server that doesn’t have a GPU.
I’ve looked through the internet but was unable to find a valid solution.
One of the answers which I came across was that The problem was that Python needs to be compiled with the --enable-shared
flag for the dlib install to succeed.
But apparently this should be avoided because it can cause additional problems.
This is the error I get.
ERROR: Command errored out with exit status 1:
command: /home/biotest/test2/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/setup.py'"'"'; __file__='"'"'/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-nmjzjw_2
cwd: /tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/
Complete output (76 lines):
running bdist_wheel
running build
running build_py
package init file 'tools/python/dlib/__init__.py' not found (or not a regular file)
running build_ext
Building extension for Python 3.6.8 (default, Nov 16 2020, 16:55:22)
Invoking CMake setup: 'cmake /tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/build/lib.linux-x86_64-3.6 -DPYTHON_EXECUTABLE=/home/biotest/test2/bin/python3 -DCMAKE_BUILD_TYPE=Release'
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: /home/biotest/test2/bin/python3 (found version "3.6.8")
-- Found PythonLibs: python3.6m
-- Performing Test HAS_CPP14_FLAG
-- Performing Test HAS_CPP14_FLAG - Failed
-- Performing Test HAS_CPP11_FLAG
-- Performing Test HAS_CPP11_FLAG - Success
-- pybind11 v2.2.4
-- Using CMake version: 3.21.1
-- Compiling dlib version: 19.22.1
CMake Error at /tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/dlib/cmake_utils/set_compiler_specific_options.cmake:50 (message):
C++11 is required to use dlib, but the version of GCC you are using is too
old and doesn't support C++11. You need GCC 4.9 or newer.
Call Stack (most recent call first):
/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/dlib/cmake_utils/test_for_sse4/CMakeLists.txt:8 (include)
CMake Error at /tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/dlib/cmake_utils/check_if_sse4_instructions_executable_on_host.cmake:13 (try_compile):
Failed to configure test project build system.
Call Stack (most recent call first):
/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/dlib/cmake_utils/set_compiler_specific_options.cmake:13 (include)
/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/dlib/CMakeLists.txt:33 (include)
-- Configuring incomplete, errors occurred!
See also "/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/build/temp.linux-x86_64-3.6/CMakeFiles/CMakeOutput.log".
See also "/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/build/temp.linux-x86_64-3.6/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/setup.py", line 261, in <module>
'Topic :: Software Development',
File "/home/biotest/test2/lib64/python3.6/site-packages/setuptools/__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "/usr/lib64/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib64/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/home/biotest/test2/lib64/python3.6/site-packages/wheel/bdist_wheel.py", line 299, in run
self.run_command('build')
File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/lib64/python3.6/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/setup.py", line 134, in run
self.build_extension(ext)
File "/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/setup.py", line 171, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "/usr/lib64/python3.6/subprocess.py", line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/tools/python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/build/lib.linux-x86_64-3.6', '-DPYTHON_EXECUTABLE=/home/biotest/test2/bin/python3', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.
----------------------------------------
ERROR: Failed building wheel for dlib
Running setup.py clean for dlib
Failed to build dlib
Installing collected packages: dlib
Running setup.py install for dlib ... error
ERROR: Command errored out with exit status 1:
command: /home/biotest/test2/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/setup.py'"'"'; __file__='"'"'/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-sfiq9dha/install-record.txt --single-version-externally-managed --compile --install-headers /home/biotest/test2/include/site/python3.6/dlib
cwd: /tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/
Complete output (78 lines):
running install
running build
running build_py
package init file 'tools/python/dlib/__init__.py' not found (or not a regular file)
running build_ext
Building extension for Python 3.6.8 (default, Nov 16 2020, 16:55:22)
Invoking CMake setup: 'cmake /tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/build/lib.linux-x86_64-3.6 -DPYTHON_EXECUTABLE=/home/biotest/test2/bin/python3 -DCMAKE_BUILD_TYPE=Release'
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: /home/biotest/test2/bin/python3 (found version "3.6.8")
-- Found PythonLibs: python3.6m
-- Performing Test HAS_CPP14_FLAG
-- Performing Test HAS_CPP14_FLAG - Failed
-- Performing Test HAS_CPP11_FLAG
-- Performing Test HAS_CPP11_FLAG - Success
-- pybind11 v2.2.4
-- Using CMake version: 3.21.1
-- Compiling dlib version: 19.22.1
CMake Error at /tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/dlib/cmake_utils/set_compiler_specific_options.cmake:50 (message):
C++11 is required to use dlib, but the version of GCC you are using is too
old and doesn't support C++11. You need GCC 4.9 or newer.
Call Stack (most recent call first):
/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/dlib/cmake_utils/test_for_sse4/CMakeLists.txt:8 (include)
CMake Error at /tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/dlib/cmake_utils/check_if_sse4_instructions_executable_on_host.cmake:13 (try_compile):
Failed to configure test project build system.
Call Stack (most recent call first):
/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/dlib/cmake_utils/set_compiler_specific_options.cmake:13 (include)
/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/dlib/CMakeLists.txt:33 (include)
-- Configuring incomplete, errors occurred!
See also "/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/build/temp.linux-x86_64-3.6/CMakeFiles/CMakeOutput.log".
See also "/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/build/temp.linux-x86_64-3.6/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/setup.py", line 261, in <module>
'Topic :: Software Development',
File "/home/biotest/test2/lib64/python3.6/site-packages/setuptools/__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "/usr/lib64/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib64/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/home/biotest/test2/lib64/python3.6/site-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/usr/lib64/python3.6/distutils/command/install.py", line 556, in run
self.run_command('build')
File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/lib64/python3.6/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/setup.py", line 134, in run
self.build_extension(ext)
File "/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/setup.py", line 171, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "/usr/lib64/python3.6/subprocess.py", line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/tools/python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/build/lib.linux-x86_64-3.6', '-DPYTHON_EXECUTABLE=/home/biotest/test2/bin/python3', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: /home/biotest/test2/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/setup.py'"'"'; __file__='"'"'/tmp/pip-install-o9l2b5q2/dlib_40beddc2aee742ccaa15ab4582c22263/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-sfiq9dha/install-record.txt --single-version-externally-managed --compile --install-headers /home/biotest/test2/include/site/python3.6/dlib Check the logs for full command output.
(test2) [root@localhost biotest]#
2
Answers
maybe you can use
conda install dlib