abetlen/llama-cpp-python

Can't install with Vulkan support in Ubuntu 24.04

Closed this issue · 1 comments

Hello! I tried to install with Vulkan support in Ubuntu 24.04 but it can't install.

$ CMAKE_ARGS="-DGGML_VULKAN=on" pip install llama-cpp-python
Collecting llama-cpp-python
  Using cached llama_cpp_python-0.3.1.tar.gz (63.9 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: typing-extensions>=4.5.0 in /home/wannaphong/miniconda3/lib/python3.12/site-packages (from llama-cpp-python) (4.12.2)
Requirement already satisfied: numpy>=1.20.0 in /home/wannaphong/miniconda3/lib/python3.12/site-packages (from llama-cpp-python) (1.26.4)
Requirement already satisfied: diskcache>=5.6.1 in /home/wannaphong/miniconda3/lib/python3.12/site-packages (from llama-cpp-python) (5.6.3)
Requirement already satisfied: jinja2>=2.11.3 in /home/wannaphong/miniconda3/lib/python3.12/site-packages (from llama-cpp-python) (3.1.4)
Requirement already satisfied: MarkupSafe>=2.0 in /home/wannaphong/miniconda3/lib/python3.12/site-packages (from jinja2>=2.11.3->llama-cpp-python) (2.1.5)
Building wheels for collected packages: llama-cpp-python
  Building wheel for llama-cpp-python (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for llama-cpp-python (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [37 lines of output]
      *** scikit-build-core 0.10.7 using CMake 3.28.3 (wheel)
      *** Configuring CMake...
      loading initial cache file /tmp/tmp9fayjmzu/build/CMakeInit.txt
      -- The C compiler identification is GNU 14.1.0
      -- The CXX compiler identification is GNU 14.1.0
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /home/wannaphong/miniconda3/bin/x86_64-conda-linux-gnu-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: /home/wannaphong/miniconda3/bin/x86_64-conda-linux-gnu-c++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Found Git: /usr/bin/git (found version "2.43.0")
      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
      -- Check if compiler accepts -pthread
      -- Check if compiler accepts -pthread - yes
      -- Found Threads: TRUE
      -- Found OpenMP_C: -fopenmp (found version "4.5")
      -- Found OpenMP_CXX: -fopenmp (found version "4.5")
      -- Found OpenMP: TRUE (found version "4.5")
      -- OpenMP found
      -- Using llamafile
      CMake Error at /usr/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
        Could NOT find Vulkan (missing: Vulkan_LIBRARY) (found version "1.3.290")
      Call Stack (most recent call first):
        /usr/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
        /usr/share/cmake-3.28/Modules/FindVulkan.cmake:600 (find_package_handle_standard_args)
        vendor/llama.cpp/ggml/src/CMakeLists.txt:597 (find_package)
      
      
      -- Configuring incomplete, errors occurred!
      
      *** CMake configuration failed
      [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

I installed vulkan sdk and can use

$ vkcube
Selected GPU 0: AMD Radeon Graphics, type: IntegratedGpu

Linux

$ uname -a
Linux ubuntu 6.11.0-1005-oem #5-Ubuntu SMP PREEMPT_DYNAMIC Tue Sep 10 16:05:20 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
$ python --version
Python 3.12.2
$ make --version
GNU Make 4.4.1
Built for x86_64-conda-linux-gnu
Copyright (C) 1988-2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ g++ --version
g++ (Ubuntu 13.2.0-23ubuntu4) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ cmake --version
cmake version 3.28.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).

Fixed! I tried to use python environment in Ubuntu without use Anaconda/miniconda. It worked!