网站首页 文章专栏 centos 7 安装 llama-cpp-python
报错信息如下:
      llama.cpp:3391:28: warning: missing initializer for member ‘ggml_cgraph::perf_runs’ [-Wmissing-field-initializers]
      llama.cpp:3391:28: warning: missing initializer for member ‘ggml_cgraph::perf_cycles’ [-Wmissing-field-initializers]
      llama.cpp:3391:28: warning: missing initializer for member ‘ggml_cgraph::perf_time_us’ [-Wmissing-field-initializers]
      make: *** [llama.o] Error 1
      ninja: build stopped: subcommand failed.
      Traceback (most recent call last):
        File "/tmp/pip-build-env-xrd4slhn/overlay/lib/python3.10/site-packages/skbuild/setuptools_wrap.py", line 674, in setup
          cmkr.make(make_args, install_target=cmake_install_target, env=env)
        File "/tmp/pip-build-env-xrd4slhn/overlay/lib/python3.10/site-packages/skbuild/cmaker.py", line 697, in make
          self.make_impl(clargs=clargs, config=config, source_dir=source_dir, install_target=install_target, env=env)
        File "/tmp/pip-build-env-xrd4slhn/overlay/lib/python3.10/site-packages/skbuild/cmaker.py", line 742, in make_impl
          raise SKBuildError(msg)
      
      An error occurred while building with CMake.
        Command:
          /tmp/pip-build-env-xrd4slhn/overlay/lib/python3.10/site-packages/cmake/data/bin/cmake --build . --target install --config Release --
        Install target:
          install
        Source directory:
          /tmp/pip-install-fgo17tc8/llama-cpp-python_900f977196c14d43b3ce8ddff7c661ba
        Working directory:
          /tmp/pip-install-fgo17tc8/llama-cpp-python_900f977196c14d43b3ce8ddff7c661ba/_skbuild/linux-x86_64-3.10/cmake-build
      Please check the install target is valid and see CMake's output for more information.
      
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for llama-cpp-python
Failed to build llama-cpp-python
ERROR: Could not build wheels for llama-cpp-python, which is required to install pyproject.toml-based projects
解决方案链接:https://github.com/imartinez/privateGPT/issues/644
gcc 版本需要 升级到 11 版本
步骤如下:
# 删除已安装的gcc yum remove gcc yum remove gdb # 安装 scl-utils yum install scl-utils yum install centos-release-scl # find devtoolset-11 yum list all --enablerepo='centos-sclo-rh' | grep "devtoolset" # 安装 devtoolset-11-toolchain 工具集 yum install -y devtoolset-11-toolchain # 添加gcc 二进进到 环境变量 add gcc 11 to PATH by adding following script to /etc/profile 把下面的指令添加到 /etc/profile 文件尾部 PATH=$PATH:/opt/rh/devtoolset-11/root/usr/bin export PATH sudo scl enable devtoolset-11 bash # 查看 gcc version and gcc11 is installed successfully. gcc --version # 再次尝试安装 pip install llama-cpp-python==0.1.50