我正在尝试在EC2 ubuntu 16.04上安装dlib,我尝试了在Google上建议的许多选项,例如this,但是遇到了错误,我将其安装在本地计算机上,这很简单且易于安装。自从我一直在思考以来,我还尝试通过更改环境来解决此问题,这可能是某些python版本兼容性问题,但是python3也遇到了相同的错误。 在这里输出:
Collecting dlib
Using cached https://files.pythonhosted.org/packages/df/aa/6a9bb2a763107bb2606d6ee1aa65fcd3b51375a9ef6436e9c9280b0dd63c/dlib-19.15.0.tar.gz
Installing collected packages: dlib
Running setup.py install for dlib ... error
Complete output from command /home/ubuntu/newEnv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-xqrlt_6v/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-record-c_7ykc12/install-record.txt --single-version-externally-managed --compile --install-headers /home/ubuntu/newEnv/include/site/python3.5/dlib:
running install
running build
running build_py
package init file 'dlib/__init__.py' not found (or not a regular file)
running build_ext
Building extension for Python 3.5.2 (default, Nov 23 2017, 16:37:01)
Invoking CMake setup: 'cmake /tmp/pip-install-xqrlt_6v/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-xqrlt_6v/dlib/build/lib.linux-x86_64-3.5 -DPYTHON_EXECUTABLE=/home/ubuntu/newEnv/bin/python3 -DCMAKE_BUILD_TYPE=Release'
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- 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
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: /home/ubuntu/newEnv/bin/python3 (found version "3.5.2")
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.5m.so
-- Performing Test HAS_CPP14_FLAG
-- Performing Test HAS_CPP14_FLAG - Success
-- pybind11 v2.2.2
-- Using CMake version: 3.12.0
-- Compiling dlib version: 19.15.0
-- SSE4 instructions can be executed by the host processor.
-- AVX instructions can be executed by the host processor.
-- Enabling AVX instructions
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
-- Looking for png_create_read_struct
-- Looking for png_create_read_struct - found
-- Searching for BLAS and LAPACK
-- Searching for BLAS and LAPACK
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Checking for module 'cblas'
-- No package 'cblas' found
-- Checking for module 'lapack'
-- Found lapack, version 0.2.18
-- Looking for sys/types.h
CMake Warning (dev) at /home/ubuntu/newEnv/lib/python3.5/site-packages/cmake/data/share/cmake-3.12/Modules/CheckIncludeFile.cmake:70 (message):
Policy CMP0075 is not set: Include file check macros honor
CMAKE_REQUIRED_LIBRARIES. Run "cmake --help-policy CMP0075" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
CMAKE_REQUIRED_LIBRARIES is set to:
/usr/lib/x86_64-linux-gnu/libpng.so;/usr/lib/x86_64-linux-gnu/libz.so
For compatibility with CMake 3.11 and below this check is ignoring it.
Call Stack (most recent call first):
/home/ubuntu/newEnv/lib/python3.5/site-packages/cmake/data/share/cmake-3.12/Modules/CheckTypeSize.cmake:225 (check_include_file)
/tmp/pip-install-xqrlt_6v/dlib/dlib/cmake_utils/find_blas.cmake:80 (check_type_size)
/tmp/pip-install-xqrlt_6v/dlib/dlib/CMakeLists.txt:545 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void*
-- Check size of void* - done
-- Found OpenBLAS library
-- Looking for sgetrf_single
-- Looking for sgetrf_single - found
-- Using OpenBLAS's built in LAPACK
-- Looking for cblas_ddot
-- Looking for cblas_ddot - found
-- Looking for sgesv
-- Looking for sgesv - not found
-- Looking for sgesv_
-- Looking for sgesv_ - not found
CUDA_TOOLKIT_ROOT_DIR not found or specified
-- Could NOT find CUDA (missing: CUDA_TOOLKIT_ROOT_DIR CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY) (Required is at least version "7.5")
-- Disabling CUDA support for dlib. DLIB WILL NOT USE CUDA
-- C++11 activated.
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/pip-install-xqrlt_6v/dlib/build/temp.linux-x86_64-3.5
Invoking CMake build: 'cmake --build . --config Release -- -j1'
Scanning dependencies of target dlib
[ 0%] Building CXX object dlib_build/CMakeFiles/dlib.dir/base64/base64_kernel_1.cpp.o
[ 1%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bigint/bigint_kernel_1.cpp.o
[ 2%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bigint/bigint_kernel_2.cpp.o
[ 3%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bit_stream/bit_stream_kernel_1.cpp.o
[ 3%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_decoder/entropy_decoder_kernel_1.cpp.o
[ 4%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_decoder/entropy_decoder_kernel_2.cpp.o
[ 5%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_encoder/entropy_encoder_kernel_1.cpp.o
[ 6%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_encoder/entropy_encoder_kernel_2.cpp.o
[ 6%] Building CXX object dlib_build/CMakeFiles/dlib.dir/md5/md5_kernel_1.cpp.o
[ 7%] Building CXX object dlib_build/CMakeFiles/dlib.dir/tokenizer/tokenizer_kernel_1.cpp.o
[ 8%] Building CXX object dlib_build/CMakeFiles/dlib.dir/unicode/unicode.cpp.o
[ 9%] Building CXX object dlib_build/CMakeFiles/dlib.dir/data_io/image_dataset_metadata.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-5/README.Bugs> for instructions.
dlib_build/CMakeFiles/dlib.dir/build.make:205: recipe for target 'dlib_build/CMakeFiles/dlib.dir/data_io/image_dataset_metadata.cpp.o' failed
make[2]: *** [dlib_build/CMakeFiles/dlib.dir/data_io/image_dataset_metadata.cpp.o] Error 4
CMakeFiles/Makefile2:145: recipe for target 'dlib_build/CMakeFiles/dlib.dir/all' failed
make[1]: *** [dlib_build/CMakeFiles/dlib.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-install-xqrlt_6v/dlib/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 "/home/ubuntu/newEnv/lib/python3.5/site-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/usr/lib/python3.5/distutils/command/install.py", line 583, in run
self.run_command('build')
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.5/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
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 "/tmp/pip-install-xqrlt_6v/dlib/setup.py", line 133, in run
self.build_extension(ext)
File "/tmp/pip-install-xqrlt_6v/dlib/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
----------------------------------------
Command "/home/ubuntu/newEnv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-xqrlt_6v/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-record-c_7ykc12/install-record.txt --single-version-externally-managed --compile --install-headers /home/ubuntu/newEnv/include/site/python3.5/dlib" failed with error code 1 in /tmp/pip-install-xqrlt_6v/dlib/
我找不到这里出什么问题了?由于同一命令在本地计算机上运行
答案 0 :(得分:3)
经过一些研发,我注意到c ++编译器至少需要4GB的内存,因此我只需将ec2 t2.micro升级到t2.medium,即可轻松安装。基本上是更少的RAM错误。
答案 1 :(得分:1)
您的C ++编译器崩溃了。将您的操作系统上的编译器版本与发生故障的系统进行比较。您的解决方案可能是过时的编译器/工具链。
答案 2 :(得分:0)
我的环境详情:
<块引用>python 3.7 & Ubuntu 16.04
1) 分配root权限,先更新ubuntu
sudo su
apt-get update
2) 检查 Python 和 pip 的版本和路径。
which python3
python3 -V
which pip3
pip3 -V
3)
pip3 install cmake
4)
apt-get install -y --fix-missing \
build-essential \
cmake \
gfortran \
git \
wget \
curl \
grapgicsmagick \
libgraphicsmagic-dev \
libatlas-dev \
libavcodec-dev \
libavformat-dev \
libgtk2.0-dev \
libjpeg-dev \
liblapack-dev \
libswscale-dev \
pkg-config \
software-properties-common \
zip
6)
apt-get install python3-dev
5)
pip3 install dlib
✅完成