simonw / llm-claude-3

LLM plugin for interacting with the Claude 3 family of models
Apache License 2.0
223 stars 21 forks source link

Fresh installation fails due to PyO3 dependency #16

Open mfasold opened 1 week ago

mfasold commented 1 week ago

I just did a fresh installation of llm via brew on a M1 Mac, followed by llm install llm-claude-3.

Here, I get the following error

Building wheels for collected packages: tokenizers
  Building wheel for tokenizers (pyproject.toml) ... error
...
      error: failed to run custom build command for `pyo3-ffi v0.21.2`

      Caused by:
        process didn't exit successfully: `/private/var/folders/sk/kx1k0x6522j0g4y_5h137d4w0000gn/T/pip-install-ev5faqat/tokenizers_22eea7ad05ff47b9b1d00ab3bf8670bb/bindings/python/target/release/build/pyo3-ffi-6e049bc9fd234003/build-script-build` (exit status: 1)
        --- stdout
        cargo:rerun-if-env-changed=PYO3_CROSS
        cargo:rerun-if-env-changed=PYO3_CROSS_LIB_DIR
        cargo:rerun-if-env-changed=PYO3_CROSS_PYTHON_VERSION
        cargo:rerun-if-env-changed=PYO3_CROSS_PYTHON_IMPLEMENTATION
        cargo:rerun-if-env-changed=PYO3_PRINT_CONFIG
        cargo:rerun-if-env-changed=PYO3_USE_ABI3_FORWARD_COMPATIBILITY

        --- stderr
        error: the configured Python interpreter version (3.13) is newer than PyO3's maximum supported version (3.12)
        = help: please check if an updated version of PyO3 is available. Current version: 0.21.2
        = help: set PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 to suppress this check and build anyway using the stable ABI
      warning: build failed, waiting for other jobs to finish...
      💥 maturin failed
        Caused by: Failed to build a native library through cargo
        Caused by: Cargo build finished with "exit status: 101": `env -u CARGO MACOSX_DEPLOYMENT_TARGET="11.0" PYO3_ENVIRONMENT_SIGNATURE="cpython-3.13-64bit" PYO3_PYTHON="/opt/homebrew/Cellar/llm/0.16/libexec/bin/python" PYTHON_SYS_EXECUTABLE="/opt/homebrew/Cellar/llm/0.16/libexec/bin/python" "cargo" "rustc" "--features" "pyo3/extension-module" "--message-format" "json-render-diagnostics" "--manifest-path" "/private/var/folders/sk/kx1k0x6522j0g4y_5h137d4w0000gn/T/pip-install-ev5faqat/tokenizers_22eea7ad05ff47b9b1d00ab3bf8670bb/bindings/python/Cargo.toml" "--release" "--lib" "--" "-C" "link-arg=-undefined" "-C" "link-arg=dynamic_lookup" "-C" "link-args=-Wl,-install_name,@rpath/tokenizers.tokenizers.cpython-313-darwin.so"`
      Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/opt/homebrew/Cellar/llm/0.16/libexec/bin/python', '--compatibility', 'off'] returned non-zero exit status 1
      [end of output]

Any ideas on that? Was there maybe a recent update to python@3.13? The suggested workaround PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 also did not work out.

ddgond commented 3 days ago

Also encountering this issue, including when uninstalling from brew and reinstalling via pipx. From what I can tell online, version 0.22 of PyO3 fixes it, but I'm not sure where that version gets specified.

schpet commented 21 hours ago

also running into this with homebrew and pipx.

workaround i'm using is to use llm via uvx

uvx --python 3.12 llm install llm-claude-3

# for some reason ANTHROPIC_API_KEY wasn't being picked up
uvx --python 3.12 llm keys set claude --value "$ANTHROPIC_API_KEY"

i saved this as an alias in fish:

alias --save llm "uvx --python 3.12 llm"