simonw / simonw/llm

llm install llm-gguf breaking llm

Open
#541 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
12.5k
Forks
998
Avg merge
3d 13h
Merged PRs (30d)
10

Description

Hi, I tried the instructions from your email on July 23rd (earlier this week) titled Llama 3.1, now available in LLM

If you've [already installed LLM](https://substack.com/redirect/a4fc3808-3c94-4ba0-8828-e8a4557dc83d?j=eyJ1IjoiYmYzaSJ9.FZHXRpAef5uQ6flxkrGAyDGxn6x5piQQIjfeFfgCuKE) the following set of commands should get you setup with Llama 3.1 8B:

llm install llm-gguf

llm gguf download-model \
  https://huggingface.co/lmstudio-community/Meta-Llama-3.1-8B-Instruct-GGUF/resolve/main/Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf \
  --alias llama-3.1-8b-instruct --alias l31i

The first step appears to complete ok. But it broke the working llm installation. This is an arm54 M1 Pro MacBook with Sonoma 14.5

llm -c -m 4o
Traceback (most recent call last):
  File "/Users/vamsee.lakamsani/Library/Python/3.12/lib/python/site-packages/llama_cpp/llama_cpp.py", line 75, in _load_shared_library
    return ctypes.CDLL(str(_lib_path), **cdll_args)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ctypes/__init__.py", line 379, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: dlopen(/Users/vamsee.lakamsani/Library/Python/3.12/lib/python/site-packages/llama_cpp/lib/libllama.dylib, 0x0006): tried: '/Users/vamsee.lakamsani/Library/Python/3.12/lib/python/site-packages/llama_cpp/lib/libllama.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/vamsee.lakamsani/Library/Python/3.12/lib/python/site-packages/llama_cpp/lib/libllama.dylib' (no such file), '/Users/vamsee.lakamsani/Library/Python/3.12/lib/python/site-packages/llama_cpp/lib/libllama.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/bin/llm", line 5, in <module>
    from llm.cli import cli
  File "/opt/homebrew/lib/python3.12/site-packages/llm/__init__.py", line 18, in <module>
    from .plugins import pm
  File "/opt/homebrew/lib/python3.12/site-packages/llm/plugins.py", line 17, in <module>
    pm.load_setuptools_entrypoints("llm")
  File "/opt/homebrew/lib/python3.12/site-packages/pluggy/_manager.py", line 421, in load_setuptools_entrypoints
    plugin = ep.load()
             ^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/metadata/__init__.py", line 205, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/vamsee.lakamsani/Library/Python/3.12/lib/python/site-packages/llm_gguf.py", line 4, in <module>
    from llama_cpp import Llama
  File "/Users/vamsee.lakamsani/Library/Python/3.12/lib/python/site-packages/llama_cpp/__init__.py", line 1, in <module>
    from .llama_cpp import *
  File "/Users/vamsee.lakamsani/Library/Python/3.12/lib/python/site-packages/llama_cpp/llama_cpp.py", line 88, in <module>
    _lib = _load_shared_library(_lib_base_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/vamsee.lakamsani/Library/Python/3.12/lib/python/site-packages/llama_cpp/llama_cpp.py", line 77, in _load_shared_library
    raise RuntimeError(f"Failed to load shared library '{_lib_path}': {e}")
RuntimeError: Failed to load shared library '/Users/vamsee.lakamsani/Library/Python/3.12/lib/python/site-packages/llama_cpp/lib/libllama.dylib': dlopen(/Users/vamsee.lakamsani/Library/Python/3.12/lib/python/site-packages/llama_cpp/lib/libllama.dylib, 0x0006): tried: '/Users/vamsee.lakamsani/Library/Python/3.12/lib/python/site-packages/llama_cpp/lib/libllama.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/vamsee.lakamsani/Library/Python/3.12/lib/python/site-packages/llama_cpp/lib/libllama.dylib' (no such file), '/Users/vamsee.lakamsani/Library/Python/3.12/lib/python/site-packages/llama_cpp/lib/libllama.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported llm install llm-gguf sequence on an Apple Silicon Mac, then run llm -c -m 4o and trace the llm_gguf and llama_cpp imports shown in the report. Done means installing the plugin no longer prevents the existing llm command from loading with a compatible native library.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, python
Domain
ai, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.