anthropic-sdk-python conflicting requirements with llm
Closed this issue · 3 comments
tomviner commented
pip gives an error when installing both llm and anthropic (the client library for Claude).
However it does install both libraries
$ pip install llm
Successfully installed PyYAML-6.0 aiohttp-3.8.4 aiosignal-1.3.1 annotated-types-0.5.0 async-timeout-4.0.2 attrs-23.1.0 certifi-2023.5.7 charset-normalizer-3.2.0 click-8.1.5 click-default-group-wheel-1.2.2 frozenlist-1.4.0 idna-3.4 llm-0.5 multidict-6.0.4 openai-0.27.8 pluggy-1.2.0 pydantic-2.0.3 pydantic-core-2.3.0 python-dateutil-2.8.2 python-ulid-1.1.0 requests-2.31.0 six-1.16.0 sqlite-fts4-1.0.3 sqlite-utils-3.33 tabulate-0.9.0 tqdm-4.65.0 typing-extensions-4.7.1 urllib3-2.0.3 yarl-1.9.2
$ pip install anthropic
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
llm 0.5 requires pydantic>=2.0.0, but you have pydantic 1.10.11 which is incompatible.
Successfully installed anthropic-0.3.4 anyio-3.7.1 distro-1.8.0 exceptiongroup-1.1.2 h11-0.14.0 httpcore-0.17.3 httpx-0.24.1 pydantic-1.10.11 sniffio-1.3.0 tokenizers-0.13.3
The problem is llm requires pydantic v2:
llm 0.5 requires pydantic>=2.0.0
but anthropic has a pyproject with:
pydantic = "^1.9.0"
which is locked with the poetry pin:
[[package]]
name = "pydantic"
version = "1.10.2"
tomviner commented
I've submitted a PR to the anthropic library removing the pydantic constraint anthropics/anthropic-sdk-python#77
tomviner commented
I've solved this for now by vendorising anthropic with this script:
https://github.com/tomviner/llm-claude/blob/main/vendorise_anthropic.sh which
- pulls the anthropic distribution from my github branch
- adds the License to the code folder
- moves the code into
llm_claude/vendored_anthropic/
tomviner commented
Will unvendorise when anthropic
is compatible with llm
.