python - Ubuntu Python : unable to pip install dlib - Failed building wheel for dlib and machine is almost stuck

标签 python django ubuntu dlib

我正在尝试为我的 django python 环境安装 dlib(机器学习库)。但是,我无法安装它。有错误并卡住。

根据这个指令,这就是我所做的 https://www.pyimagesearch.com/2017/03/27/how-to-install-dlib/

$ sudo apt-get install build-essential cmake
$ sudo apt-get install libgtk-3-dev
$ sudo apt-get install libboost-all-dev

$ source somedotcomenv/bin/activate <-- virtualenv

$ pip install numpy
$ pip install scipy
$ pip install scikit-image
$ pip install dlib

但是,它失败了,我认为卡住了,在最后阶段将近一个小时。我不确定它是否仍在编译。
  [ 82%] Building CXX object CMakeFiles/dlib_.dir/src/dlib.cpp.o
  In file included from /usr/include/boost/python/detail/prefix.hpp:13:0,
                   from /usr/include/boost/python/args.hpp:8,
                   from /usr/include/boost/python.hpp:11,
                   from /tmp/pip-build-8xkp8e7q/dlib/tools/python/src/dlib.cpp:4:
  /usr/include/boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or directory
  compilation terminated.
  CMakeFiles/dlib_.dir/build.make:62: recipe for target 'CMakeFiles/dlib_.dir/src/dlib.cpp.o' failed
  make[2]: *** [CMakeFiles/dlib_.dir/src/dlib.cpp.o] Error 1
  CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/dlib_.dir/all' failed
  error: cmake build failed!

  ----------------------------------------
  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 ... 

完整的执行和错误日志在这里 https://gist.github.com/axilaris/fe58937e8ac39386e6e9816833636461

这是最后一个顶级进程,它不确定它是否仍在编译,但它已经过了一个小时。有什么东西卡住了。即使尝试在另一个命令行上键入内容也非常慢。
PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND                                                                                      
   30 root      20   0       0      0      0 S  9.2  0.0   6:21.82 kswapd0                                                                                      
 4550 deploy    20   0   95372    980      0 S  0.3  0.1   0:01.59 sshd                                                                                         
 4566 deploy    20   0  184852  14756    684 D  0.3  1.5   0:04.70 gunicorn                                                                                     
 4934 deploy    20   0  256084  15712     28 D  0.3  1.5   0:10.05 python3                                                                                      
 5646 deploy    20   0  757604 567016      0 D  0.3 55.9   0:29.41 cc1plus                                                                                      
 5770 postgres  20   0  294548   4808   2344 D  0.3  0.5   0:00.23 postgres                                                                                     
 5773 postgres  20   0  294384   4648   2244 D  0.3  0.5   0:00.17 postgres                                                                                     
 9531 root      20   0  280224   8360      0 S  0.3  0.8   1:06.10 snapd  

我正在使用 AWS ubuntu-xenial-16.04-amd64-server-20171026.1 (ami-da05a4a0)

最佳答案

尝试在此拉取请求中使用 dlib 的版本 https://github.com/davisking/dlib/pull/1040 .它消除了对 boost 的依赖,因此应该可以解决您的问题。

关于python - Ubuntu Python : unable to pip install dlib - Failed building wheel for dlib and machine is almost stuck,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48235743/

相关文章:

python - 如何在 Pytorch 中为图像及​​其掩模制作自定义数据集?

Python - 完全相同的循环工作不一致 'int'对象不可迭代 - 不迭代 int

python - 检查字符串为 1, 0 否则打印字符串

python - 星号(星号)在 f 弦中起什么作用?

django - 打开() "/root/project/static/*.css"失败(13 : Permission denied) nginx

带有 django-nose : two identical settings files with different behavior in running test command 的 Django

javascript - 根据数据库中的值更改 td 单元格的颜色

python - Django - 外键根据其内容引用两个表之一

linux - MongoDB 连接被拒绝 Errno :111

linux - Docker:设备上没有剩余空间,但 Ubuntu 有超过 900GB 的可用空间