Giter VIP home page Giter VIP logo

Comments (8)

dimbleby avatar dimbleby commented on June 18, 2024

environment variables are passed through and so this works today - as we can tell by the error message when I try the install on my system that does not have cuda:

$ CMAKE_ARGS="-DLLAMA_CUDA=on" poetry add llama-cpp-python
Using version ^0.2.62 for llama-cpp-python

Updating dependencies
Resolving dependencies... (1.1s)

Package operations: 6 installs, 0 updates, 0 removals

  - Installing markupsafe (2.1.5)
  - Installing diskcache (5.6.3)
  - Installing jinja2 (3.1.3)
  - Installing numpy (1.26.4)
  - Installing typing-extensions (4.11.0)
  - Installing llama-cpp-python (0.2.62): Failed

  ChefBuildError

  Backend subprocess exited when trying to invoke build_wheel

  *** scikit-build-core 0.9.0 using CMake 3.22.1 (wheel)
  *** Configuring CMake...
  loading initial cache file /tmp/tmpa0_n9frt/build/CMakeInit.txt
  -- The C compiler identification is GNU 11.4.0
  -- The CXX compiler identification is GNU 11.4.0
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /usr/bin/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: /usr/bin/c++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done                                                                                       -- Found Git: /usr/bin/git (found version "2.34.1")                                                                            -- Looking for pthread.h
  -- Looking for pthread.h - found
  -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
  -- Found Threads: TRUE
  -- Could not find nvcc, please set CUDAToolkit_ROOT.
  CMake Warning at vendor/llama.cpp/CMakeLists.txt:464 (message):
    CUDA not found


  -- CUDA host compiler is GNU
  CMake Error at vendor/llama.cpp/CMakeLists.txt:909 (get_flags):
    get_flags Function invoked with incorrect arguments for function named:
    get_flags


  -- Warning: ccache not found - consider installing it for faster compilation or disable this warning with LLAMA_CCACHE=OFF
  -- CMAKE_SYSTEM_PROCESSOR: x86_64
  -- x86 detected
  INSTALL TARGETS - target llama has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION.
  INSTALL TARGETS - target llama has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION.
  -- Configuring incomplete, errors occurred!
  See also "/tmp/tmpa0_n9frt/build/CMakeFiles/CMakeOutput.log".

  *** CMake configuration failed

from poetry.

zhangyilun avatar zhangyilun commented on June 18, 2024

environment variables are passed through and so this works today - as we can tell by the error message when I try the install on my system that does not have cuda:

$ CMAKE_ARGS="-DLLAMA_CUDA=on" poetry add llama-cpp-python
Using version ^0.2.62 for llama-cpp-python

Updating dependencies
Resolving dependencies... (1.1s)

Package operations: 6 installs, 0 updates, 0 removals

  - Installing markupsafe (2.1.5)
  - Installing diskcache (5.6.3)
  - Installing jinja2 (3.1.3)
  - Installing numpy (1.26.4)
  - Installing typing-extensions (4.11.0)
  - Installing llama-cpp-python (0.2.62): Failed

  ChefBuildError

  Backend subprocess exited when trying to invoke build_wheel

  *** scikit-build-core 0.9.0 using CMake 3.22.1 (wheel)
  *** Configuring CMake...
  loading initial cache file /tmp/tmpa0_n9frt/build/CMakeInit.txt
  -- The C compiler identification is GNU 11.4.0
  -- The CXX compiler identification is GNU 11.4.0
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /usr/bin/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: /usr/bin/c++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done                                                                                       -- Found Git: /usr/bin/git (found version "2.34.1")                                                                            -- Looking for pthread.h
  -- Looking for pthread.h - found
  -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
  -- Found Threads: TRUE
  -- Could not find nvcc, please set CUDAToolkit_ROOT.
  CMake Warning at vendor/llama.cpp/CMakeLists.txt:464 (message):
    CUDA not found


  -- CUDA host compiler is GNU
  CMake Error at vendor/llama.cpp/CMakeLists.txt:909 (get_flags):
    get_flags Function invoked with incorrect arguments for function named:
    get_flags


  -- Warning: ccache not found - consider installing it for faster compilation or disable this warning with LLAMA_CCACHE=OFF
  -- CMAKE_SYSTEM_PROCESSOR: x86_64
  -- x86 detected
  INSTALL TARGETS - target llama has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION.
  INSTALL TARGETS - target llama has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION.
  -- Configuring incomplete, errors occurred!
  See also "/tmp/tmpa0_n9frt/build/CMakeFiles/CMakeOutput.log".

  *** CMake configuration failed

I have run on machine with CUDA the above exact command, no error during installation but when I load the model, it's loading it on CPU, telling me the installation went wrong. When I use or regular pip install, I was able to install it correctly with CUDA and the model will be loaded on GPU.

from poetry.

dimbleby avatar dimbleby commented on June 18, 2024

perhaps you have a cached wheel that was built before you set environment variables, suggest clearing your cache.

per my previous message, this definitely works as expected already

from poetry.

zhangyilun avatar zhangyilun commented on June 18, 2024

@dimbleby Hmm yeah, it's now working after I specify --no-cache, wonder if it's from 0.2.63 as last week it didn't work when I was using 0.2.62.

On another side note, that message can occur even if you have Nvidia GPU. It was complaining that nvcc isn't available, which can occur if someone is using the base cuda docker image and not the devel one.

Another question if you don't mind. I checked pyproject.toml file and it just shows llama-cpp-python = "^0.2.63". I'm I'm using the pyprojet.toml or the lock file to install packages in another environment, how would llama-cpp-python know to install with the CUDA flag as it's not specified anywhere. Thank you!

from poetry.

dimbleby avatar dimbleby commented on June 18, 2024

poetry does not record environment variables, you will have to be careful of that yourself

from poetry.

zhangyilun avatar zhangyilun commented on June 18, 2024

I guess that's probably the main feature I'm requesting here, maybe I only described the error/wrong behavior. For example when something like above is run with flag, that can be recorded in pyproject.toml and lock file.

Otherwise, if I installed with CMAKE_ARGS="-DLLAMA_CUDA=on" pip install llama-cpp-python, updated pyproject.toml and lock file, and I (or someone else) install dependencies in a new environment, it will have the wrong installation. That person will have to uninstall and re-install with the correct flag specified, which makes package dependency management a mess.

from poetry.

dimbleby avatar dimbleby commented on June 18, 2024

python source distributions can do whatever they want at build time: to give a reproducible build poetry would have to store not only all environment variables, but also the result of any network calls, the state of the system random number generator, the phase of the moon, etc.

(this is not going to happen)

if you want people to get the same binaries, you should build binary distributions and put them somewhere eg a private repository and point at those

from poetry.

github-actions avatar github-actions commented on June 18, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

from poetry.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.