Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pip Install faling in colab #1366

Closed
Orneyfish opened this issue Apr 20, 2024 · 7 comments · Fixed by #1370
Closed

Pip Install faling in colab #1366

Orneyfish opened this issue Apr 20, 2024 · 7 comments · Fixed by #1370

Comments

@Orneyfish
Copy link

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • [Yes ] I am running the latest code. Development is very rapid so there are no tagged versions as of now.
  • [Yes ] I carefully followed the README.md.
  • [ Yes] I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
  • [Yes ] I reviewed the Discussions, and have a new bug or useful enhancement to share.

Expected Behavior

CMAKE_ARGS="-DLLAMA_CUDA=on" pip install llama-cpp-python
This should be installing in colab environment. It worked up untill yesterday but now it is failing to install.

Current Behavior

Collecting llama-cpp-python
Downloading llama_cpp_python-0.2.63.tar.gz (37.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 37.5/37.5 MB 42.1 MB/s eta 0:00:00
Installing build dependencies ... done
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
Getting requirements to build wheel ... error
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

@abetlen
Copy link
Owner

abetlen commented Apr 20, 2024

Can you retry with --verbose?

@Orneyfish
Copy link
Author

Using pip 23.1.2 from /usr/local/lib/python3.10/dist-packages/pip (python 3.10)
Collecting llama-cpp-python
  Downloading llama_cpp_python-0.2.63.tar.gz (37.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 37.5/37.5 MB 15.7 MB/s eta 0:00:00
  Running command pip subprocess to install build dependencies
  Using pip 23.1.2 from /usr/local/lib/python3.10/dist-packages/pip (python 3.10)
  Collecting scikit-build-core[pyproject]>=0.5.1
    Downloading scikit_build_core-0.9.1-py3-none-any.whl (151 kB)
       ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 151.5/151.5 kB 3.1 MB/s eta 0:00:00
  Collecting exceptiongroup>=1.0 (from scikit-build-core[pyproject]>=0.5.1)
    Downloading exceptiongroup-1.2.1-py3-none-any.whl (16 kB)
  Collecting packaging>=21.3 (from scikit-build-core[pyproject]>=0.5.1)
    Downloading packaging-24.0-py3-none-any.whl (53 kB)
       ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 53.5/53.5 kB 5.1 MB/s eta 0:00:00
  Collecting pathspec>=0.10.1 (from scikit-build-core[pyproject]>=0.5.1)
    Downloading pathspec-0.12.1-py3-none-any.whl (31 kB)
  Collecting tomli>=1.2.2 (from scikit-build-core[pyproject]>=0.5.1)
    Downloading tomli-2.0.1-py3-none-any.whl (12 kB)
  Installing collected packages: tomli, pathspec, packaging, exceptiongroup, scikit-build-core
  Successfully installed exceptiongroup-1.2.1 packaging-24.0 pathspec-0.12.1 scikit-build-core-0.9.1 tomli-2.0.1
  Installing build dependencies ... done
  Running command Getting requirements to build wheel
  Traceback (most recent call last):
    File "/tmp/pip-build-env-_cf4p64j/overlay/local/lib/python3.10/dist-packages/scikit_build_core/program_search.py", line 81, in get_cmake_program
      result = Run().capture(cmake_path, "-E", "capabilities")
    File "/tmp/pip-build-env-_cf4p64j/overlay/local/lib/python3.10/dist-packages/scikit_build_core/_shutil.py", line 43, in capture
      return self._run(args, capture=True)
    File "/tmp/pip-build-env-_cf4p64j/overlay/local/lib/python3.10/dist-packages/scikit_build_core/_shutil.py", line 71, in _run
      return subprocess.run(
    File "/usr/lib/python3.10/subprocess.py", line 526, in run
      raise CalledProcessError(retcode, process.args,
  subprocess.CalledProcessError: Command '['/usr/local/bin/cmake', '-E', 'capabilities']' returned non-zero exit status 1.

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/tmp/pip-build-env-_cf4p64j/overlay/local/lib/python3.10/dist-packages/scikit_build_core/program_search.py", line 90, in get_cmake_program
      result = Run().capture(cmake_path, "--version")
    File "/tmp/pip-build-env-_cf4p64j/overlay/local/lib/python3.10/dist-packages/scikit_build_core/_shutil.py", line 43, in capture
      return self._run(args, capture=True)
    File "/tmp/pip-build-env-_cf4p64j/overlay/local/lib/python3.10/dist-packages/scikit_build_core/_shutil.py", line 71, in _run
      return subprocess.run(
    File "/usr/lib/python3.10/subprocess.py", line 526, in run
      raise CalledProcessError(retcode, process.args,
  subprocess.CalledProcessError: Command '['/usr/local/bin/cmake', '--version']' returned non-zero exit status 1.

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/tmp/pip-build-env-_cf4p64j/overlay/local/lib/python3.10/dist-packages/scikit_build_core/build/__init__.py", line 126, in get_requires_for_build_wheel
      [*requires.cmake(), *requires.ninja()] if requires.settings.wheel.cmake else []
    File "/tmp/pip-build-env-_cf4p64j/overlay/local/lib/python3.10/dist-packages/scikit_build_core/builder/get_requires.py", line 78, in cmake
      cmake = best_program(get_cmake_programs(module=False), version=cmake_verset)
    File "/tmp/pip-build-env-_cf4p64j/overlay/local/lib/python3.10/dist-packages/scikit_build_core/program_search.py", line 169, in best_program
      for program in programs:
    File "/tmp/pip-build-env-_cf4p64j/overlay/local/lib/python3.10/dist-packages/scikit_build_core/program_search.py", line 125, in get_cmake_programs
      yield get_cmake_program(cmake_path)
    File "/tmp/pip-build-env-_cf4p64j/overlay/local/lib/python3.10/dist-packages/scikit_build_core/program_search.py", line 105, in get_cmake_program
      result.stdout,
  UnboundLocalError: local variable 'result' referenced before assignment

While cmake --version returned

cmake version 3.27.9

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

@blepabyte
Copy link

Also ran into this. Seems to be a result of scikit-build-core v0.9.1 (scikit-build/scikit-build-core#717). No issue with v0.9.0.

The cmake bin is a Python script that does from cmake import cmake; cmake() but for whatever reason, the cmake package isn't installed inside the pip build environment so it's a ModuleNotFoundError that makes the subprocess fail rather than anything to do with the actual cmake itself.

@louispaulet
Copy link

Command:

!CMAKE_ARGS="-DLLAMA_CUBLAS=on" FORCE_CMAKE=1 pip install llama-cpp-python==0.2.62 --force-reinstall --upgrade --no-cache-dir --verbose

Result:

Using pip 23.1.2 from /usr/local/lib/python3.10/dist-packages/pip (python 3.10)
Collecting llama-cpp-python==0.2.62
  Downloading llama_cpp_python-0.2.62.tar.gz (37.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 37.5/37.5 MB 189.2 MB/s eta 0:00:00
  Running command pip subprocess to install build dependencies
  Using pip 23.1.2 from /usr/local/lib/python3.10/dist-packages/pip (python 3.10)
  Collecting scikit-build-core[pyproject]>=0.5.1
    Using cached scikit_build_core-0.9.1-py3-none-any.whl (151 kB)
  Collecting exceptiongroup>=1.0 (from scikit-build-core[pyproject]>=0.5.1)
    Using cached exceptiongroup-1.2.1-py3-none-any.whl (16 kB)
  Collecting packaging>=21.3 (from scikit-build-core[pyproject]>=0.5.1)
    Using cached packaging-24.0-py3-none-any.whl (53 kB)
  Collecting pathspec>=0.10.1 (from scikit-build-core[pyproject]>=0.5.1)
    Using cached pathspec-0.12.1-py3-none-any.whl (31 kB)
  Collecting tomli>=1.2.2 (from scikit-build-core[pyproject]>=0.5.1)
    Using cached tomli-2.0.1-py3-none-any.whl (12 kB)
  Installing collected packages: tomli, pathspec, packaging, exceptiongroup, scikit-build-core
  Successfully installed exceptiongroup-1.2.1 packaging-24.0 pathspec-0.12.1 scikit-build-core-0.9.1 tomli-2.0.1
  Installing build dependencies ... done
  Running command Getting requirements to build wheel
  Traceback (most recent call last):
    File "/tmp/pip-build-env-mucgx514/overlay/local/lib/python3.10/dist-packages/scikit_build_core/program_search.py", line 81, in get_cmake_program
      result = Run().capture(cmake_path, "-E", "capabilities")
    File "/tmp/pip-build-env-mucgx514/overlay/local/lib/python3.10/dist-packages/scikit_build_core/_shutil.py", line 43, in capture
      return self._run(args, capture=True)
    File "/tmp/pip-build-env-mucgx514/overlay/local/lib/python3.10/dist-packages/scikit_build_core/_shutil.py", line 71, in _run
      return subprocess.run(
    File "/usr/lib/python3.10/subprocess.py", line 526, in run
      raise CalledProcessError(retcode, process.args,
  subprocess.CalledProcessError: Command '['/usr/local/bin/cmake', '-E', 'capabilities']' returned non-zero exit status 1.

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/tmp/pip-build-env-mucgx514/overlay/local/lib/python3.10/dist-packages/scikit_build_core/program_search.py", line 90, in get_cmake_program
      result = Run().capture(cmake_path, "--version")
    File "/tmp/pip-build-env-mucgx514/overlay/local/lib/python3.10/dist-packages/scikit_build_core/_shutil.py", line 43, in capture
      return self._run(args, capture=True)
    File "/tmp/pip-build-env-mucgx514/overlay/local/lib/python3.10/dist-packages/scikit_build_core/_shutil.py", line 71, in _run
      return subprocess.run(
    File "/usr/lib/python3.10/subprocess.py", line 526, in run
      raise CalledProcessError(retcode, process.args,
  subprocess.CalledProcessError: Command '['/usr/local/bin/cmake', '--version']' returned non-zero exit status 1.

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/tmp/pip-build-env-mucgx514/overlay/local/lib/python3.10/dist-packages/scikit_build_core/build/__init__.py", line 126, in get_requires_for_build_wheel
      [*requires.cmake(), *requires.ninja()] if requires.settings.wheel.cmake else []
    File "/tmp/pip-build-env-mucgx514/overlay/local/lib/python3.10/dist-packages/scikit_build_core/builder/get_requires.py", line 78, in cmake
      cmake = best_program(get_cmake_programs(module=False), version=cmake_verset)
    File "/tmp/pip-build-env-mucgx514/overlay/local/lib/python3.10/dist-packages/scikit_build_core/program_search.py", line 169, in best_program
      for program in programs:
    File "/tmp/pip-build-env-mucgx514/overlay/local/lib/python3.10/dist-packages/scikit_build_core/program_search.py", line 125, in get_cmake_programs
      yield get_cmake_program(cmake_path)
    File "/tmp/pip-build-env-mucgx514/overlay/local/lib/python3.10/dist-packages/scikit_build_core/program_search.py", line 105, in get_cmake_program
      result.stdout,
  UnboundLocalError: local variable 'result' referenced before assignment
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /usr/bin/python3 /usr/local/lib/python3.10/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py get_requires_for_build_wheel /tmp/tmp2pe6z4bm
  cwd: /tmp/pip-install-ahu3u7s8/llama-cpp-python_4eaa4b6dbc934dbf8bf74860e97a5181
  Getting requirements to build wheel ... error
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

I didn't change anything, it worked yesterday, but failed today.
The change either comes from Colab or 0.2.62 llama-cpp-python (wheel overwrite?)

@louispaulet
Copy link

louispaulet commented Apr 20, 2024

I found a way to make it work on Google Colab! (GPU support works)

First install OK version of scikit:

!pip install scikit-build-core==0.9.0

Then use this "build isolation" version of the build command:

!CMAKE_ARGS="-DLLAMA_CUBLAS=on -DCMAKE_CUDA_ARCHITECTURES=61" FORCE_CMAKE=1 pip install llama-cpp-python==0.2.62 --force-reinstall --upgrade --no-cache-dir --verbose --no-build-isolation

EDIT: works on T4, you may need to change the flags for other GPUs.

@abetlen
Copy link
Owner

abetlen commented Apr 20, 2024

Yes looks like it's been reported now in scikit-build-core scikit-build/scikit-build-core#718 so I'll keep an eye on it. I may add a <0.9.1 constraint to the next release if it's not resolved by then but prefer not to.

@evelkey
Copy link
Contributor

evelkey commented Apr 21, 2024

It's already fixed in version 0.9.2. I created a PR here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants