mpiigaze的安装过程一

mpiigaze链接

mpiigaze应该不是作者本人写的,而是社区工作者的杰作,对原论文Appearance-Based Gaze Estimation in the Wild的代码进行的一些复现

1.创建conda环境

2.问题

Building wheels for collected packages: dlib
  Building wheel for dlib (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for dlib (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [41 lines of output]
      running bdist_wheel
      running build
      running build_ext
      
      ================================================================================
      ================================================================================
      ================================================================================
      
                         CMake is not installed on your system!
      
          Or it is possible some broken copy of cmake is installed on your system.
          It is unfortunately very common for python package managers to include
          broken copies of cmake.  So if the error above this refers to some file
          path to a cmake file inside a python or anaconda or miniconda path then you
          should delete that broken copy of cmake from your computer.
      
          Instead, please get an official copy of cmake from one of these known good
          sources of an official cmake:
              - cmake.org (this is how windows users should get cmake)
              - apt install cmake (for Ubuntu or Debian based systems)
              - yum install cmake (for Redhat or CenOS based systems)
      
          On a linux machine you can run `which cmake` to see what cmake you are
          actually using.  If it tells you it's some cmake from any kind of python
          packager delete it and install an official cmake.
      
          More generally, cmake is not installed if when you open a terminal window
          and type
             cmake --version
          you get an error.  So you can use that as a very basic test to see if you
          have cmake installed.  That is, if cmake --version doesn't run from the
          same terminal window from which you are reading this error message, then
          you have not installed cmake.  Windows users should take note that they
          need to tell the cmake installer to add cmake to their PATH.  Since you
          can't run commands that are not in your PATH.  This is how the PATH works
          on Linux as well, but failing to add cmake to the PATH is a particularly
          common problem on windows and rarely a problem on Linux.
      
      ================================================================================
      ================================================================================
      ================================================================================
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for dlib
Failed to build dlib
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (dlib)

问题是系统上没有安装 CMake,或者安装的 CMake 是损坏的/不正确的版本,导致 dlib 库无法成功构建。

dlib 是一个 C++ 库,它提供了很多机器学习算法,包括人脸检测和地标检测等功能。当你在 Python 中安装 dlib 时,它需要先编译 C++ 代码,而这个编译过程依赖于 CMake。

第一种安装是:sudo apt install cmake这个需要sudo权限

然而我没有sudo权限,

[sudo] password for zhouy24: 
zhouy24 is not in the sudoers file.  This incident will be reported.

所以使用不需要sudo的方式:
由于我使用conda创建环境了,所以 使用命令:conda install -c anaconda cmake 指定从 anaconda 频道安装,这通常更稳定。

(mpiigaze) zhouy24@RL-DSlab:~/zhouy24Files/mpiigaze/pytorch_mpiigaze$ conda install -c anaconda cmake
Channels:
 - anaconda
 - conda-forge
 - defaults
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /home/zhouy24/miniconda3/envs/mpiigaze

  added / updated specs:
    - cmake


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    c-ares-1.19.1              |       h5eee18b_0         114 KB  anaconda
    cmake-3.31.2               |       h27e300b_0        21.9 MB  anaconda
    expat-2.7.1                |       h6a678d5_0         198 KB  anaconda
    krb5-1.21.3                |       h8a1dbc1_1         1.4 MB  anaconda
    libcurl-8.14.1             |       h31d0fb7_0         473 KB  anaconda
    libedit-3.1.20230828       |       h5eee18b_0         191 KB  anaconda
    libev-4.33                 |       h7f8727e_1         106 KB  anaconda
    libnghttp2-1.57.0          |       h2d74bed_0         705 KB  anaconda
    libsqlite-3.46.0           |       hde9e2c9_0         845 KB  conda-forge
    libssh2-1.11.1             |       h251f7ec_0         294 KB  anaconda
    libuv-1.48.0               |       h5eee18b_0         1.1 MB  anaconda
    libxcb-1.17.0              |       h9b100fa_0         407 KB  anaconda
    libzlib-1.2.13             |       h4ab18f5_6          60 KB  conda-forge
    lz4-c-1.9.4                |       h6a678d5_1         161 KB  anaconda
    pthread-stubs-0.3          |       h0ce48e5_1           5 KB  anaconda
    python-3.8.20              |       he870216_0        24.3 MB  anaconda
    rhash-1.4.3                |       hdbd6064_0         256 KB  anaconda
    sqlite-3.50.2              |       hb25bd0a_1         1.6 MB  anaconda
    tk-8.6.14                  |       h993c535_1         3.4 MB  anaconda
    xorg-libx11-1.8.12         |       h9b100fa_1         922 KB  anaconda
    xorg-libxau-1.0.12         |       h9b100fa_0          14 KB  anaconda
    xorg-libxdmcp-1.1.5        |       h9b100fa_0          20 KB  anaconda
    xorg-xorgproto-2024.1      |       h5eee18b_1         560 KB  anaconda
    zlib-1.2.13                |       h4ab18f5_6          91 KB  conda-forge
    zstd-1.5.6                 |       hc292b87_0         1.0 MB  anaconda
    ------------------------------------------------------------
                                           Total:        59.9 MB

The following NEW packages will be INSTALLED:

  c-ares             anaconda/linux-64::c-ares-1.19.1-h5eee18b_0 
  cmake              anaconda/linux-64::cmake-3.31.2-h27e300b_0 
  expat              anaconda/linux-64::expat-2.7.1-h6a678d5_0 
  krb5               anaconda/linux-64::krb5-1.21.3-h8a1dbc1_1 
  libcurl            anaconda/linux-64::libcurl-8.14.1-h31d0fb7_0 
  libedit            anaconda/linux-64::libedit-3.1.20230828-h5eee18b_0 
  libev              anaconda/linux-64::libev-4.33-h7f8727e_1 
  libnghttp2         anaconda/linux-64::libnghttp2-1.57.0-h2d74bed_0 
  libssh2            anaconda/linux-64::libssh2-1.11.1-h251f7ec_0 
  libuv              anaconda/linux-64::libuv-1.48.0-h5eee18b_0 
  libxcb             anaconda/linux-64::libxcb-1.17.0-h9b100fa_0 
  lz4-c              anaconda/linux-64::lz4-c-1.9.4-h6a678d5_1 
  pthread-stubs      anaconda/linux-64::pthread-stubs-0.3-h0ce48e5_1 
  rhash              anaconda/linux-64::rhash-1.4.3-hdbd6064_0 
  sqlite             anaconda/linux-64::sqlite-3.50.2-hb25bd0a_1 
  xorg-libx11        anaconda/linux-64::xorg-libx11-1.8.12-h9b100fa_1 
  xorg-libxau        anaconda/linux-64::xorg-libxau-1.0.12-h9b100fa_0 
  xorg-libxdmcp      anaconda/linux-64::xorg-libxdmcp-1.1.5-h9b100fa_0 
  xorg-xorgproto     anaconda/linux-64::xorg-xorgproto-2024.1-h5eee18b_1 
  zlib               conda-forge/linux-64::zlib-1.2.13-h4ab18f5_6 
  zstd               anaconda/linux-64::zstd-1.5.6-hc292b87_0 

The following packages will be UPDATED:

  tk                 conda-forge::tk-8.6.13-noxft_hd72426e~ --> anaconda::tk-8.6.14-h993c535_1 

The following packages will be SUPERSEDED by a higher-priority channel:

  python             conda-forge::python-3.8.20-h4a871b0_2~ --> anaconda::python-3.8.20-he870216_0 

The following packages will be DOWNGRADED:

  libsqlite                               3.50.3-hee844dc_0 --> 3.46.0-hde9e2c9_0 
  libzlib                                  1.3.1-hb9d3cd8_2 --> 1.2.13-h4ab18f5_6 


Proceed ([y]/n)? y


Downloading and Extracting Packages:
                                                                                                                                                                               
Preparing transaction: done                                                                                                                                                    
Verifying transaction: done                                                                                                                                                    
Executing transaction: done                   

验证安装:

cmake --version

如果在 Conda 环境中成功安装,当你激活该环境时,cmake --version 应该可以正常运行。停用环境后,cmake 命令可能就找不到了。

(mpiigaze) zhouy24@RL-DSlab:~/zhouy24Files/mpiigaze/pytorch_mpiigaze$ cmake --version
cmake version 3.31.2    

之后使用pip下载命令:
(mpiigaze) zhouy24@RL-DSlab:~/zhouy24Files/mpiigaze/pytorch_mpiigaze$ pip install -r requirements.txt
除去一堆下载之外,最重要的是:

Building wheels for collected packages: dlib
  Building wheel for dlib (pyproject.toml) ... done
  Created wheel for dlib: filename=dlib-20.0.0-cp38-cp38-linux_x86_64.whl size=3973919 sha256=3a6b5f5508cafa89392278cba89fa01cd5e953506f7e96208b19651e9e405f53
  Stored in directory: /home/zhouy24/.cache/pip/wheels/29/a3/42/e1f8773f2019449881db7ae7488211a3b3e97a72e21b944970
Successfully built dlib
Installing collected packages: pytz, mpmath, dlib, tzdata, typing-extensions, tqdm, termcolor, tabulate, sympy, six, pyyaml, protobuf, portalocker, Pillow, packaging, nvidia-nvtx-cu12, nvidia-nvjitlink-cu12, nvidia-nccl-cu12, nvidia-curand-cu12, nvidia-cufft-cu12, nvidia-cuda-runtime-cu12, nvidia-cuda-nvrtc-cu12, nvidia-cuda-cupti-cu12, nvidia-cublas-cu12, numpy, networkx, MarkupSafe, fsspec, filelock, yacs, triton, tensorboardX, scipy, python-dateutil, opencv-python, nvidia-cusparse-cu12, nvidia-cudnn-cu12, jinja2, iopath, h5py, pandas, nvidia-cusolver-cu12, fvcore, torch, torchvision
Successfully installed MarkupSafe-2.1.5 Pillow-10.4.0 dlib-20.0.0 filelock-3.16.1 fsspec-2025.3.0 fvcore-0.1.5.post20221221 h5py-3.11.0 iopath-0.1.10 jinja2-3.1.6 mpmath-1.3.0 networkx-3.1 numpy-1.24.4 nvidia-cublas-cu12-12.1.3.1 nvidia-cuda-cupti-cu12-12.1.105 nvidia-cuda-nvrtc-cu12-12.1.105 nvidia-cuda-runtime-cu12-12.1.105 nvidia-cudnn-cu12-9.1.0.70 nvidia-cufft-cu12-11.0.2.54 nvidia-curand-cu12-10.3.2.106 nvidia-cusolver-cu12-11.4.5.107 nvidia-cusparse-cu12-12.1.0.106 nvidia-nccl-cu12-2.20.5 nvidia-nvjitlink-cu12-12.9.86 nvidia-nvtx-cu12-12.1.105 opencv-python-4.12.0.88 packaging-25.0 pandas-2.0.3 portalocker-3.0.0 protobuf-5.29.5 python-dateutil-2.9.0.post0 pytz-2025.2 pyyaml-6.0.2 scipy-1.10.1 six-1.17.0 sympy-1.13.3 tabulate-0.9.0 tensorboardX-2.6.2.2 termcolor-2.4.0 torch-2.4.1 torchvision-0.19.1 tqdm-4.67.1 triton-3.0.0 typing-extensions-4.13.2 tzdata-2025.2 yacs-0.1.8

你可能感兴趣的:(python)