-
Notifications
You must be signed in to change notification settings - Fork 184
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 anthropic
currently fails on Python 3.13
#718
Comments
One option could be to make the |
... oh, it looks like it's not just From this comment: It looks like that project is waiting on this fix too: |
pip install anthropic
currently fails on Python 3.13, maybe drop tokenizers
requirementpip install anthropic
currently fails on Python 3.13
3.12 failing also |
@wizardofozzie can you open a separate issue for 3.12? That should already be supported |
Correction: it looks like that library has available Python 3.13 wheels already: https://pypi.org/project/jiter/0.6.1/#files |
So actually I think the underlying problem is this: I think dropping |
I did some digging around and it turns out Here's what happens in an environment without that module installed: >>> import anthropic
>>> client = anthropic.Anthropic()
>>> client.count_tokens("hi")
Traceback (most recent call last):
File "<python-input-3>", line 1, in <module>
client.count_tokens("hi")
~~~~~~~~~~~~~~~~~~~^^^^^^
File "/Users/simon/Dropbox/Development/anthropic-sdk-python/src/anthropic/_client.py", line 281, in count_tokens
tokenizer = self.get_tokenizer()
File "/Users/simon/Dropbox/Development/anthropic-sdk-python/src/anthropic/_client.py", line 286, in get_tokenizer
return sync_get_tokenizer()
File "/Users/simon/Dropbox/Development/anthropic-sdk-python/src/anthropic/_tokenizers.py", line 41, in sync_get_tokenizer
return _load_tokenizer(text)
File "/Users/simon/Dropbox/Development/anthropic-sdk-python/src/anthropic/_tokenizers.py", line 29, in _load_tokenizer
from tokenizers import Tokenizer
ModuleNotFoundError: No module named 'tokenizers' |
I ended up making these changes and now the test suite passes for Python 3.13 on my laptop: diff --git a/.python-version b/.python-version
index 43077b2..3a4f41e 100644
--- a/.python-version
+++ b/.python-version
@@ -1 +1 @@
-3.9.18
+3.13
\ No newline at end of file
diff --git a/pyproject.toml b/pyproject.toml
index 1ccb9a4..924b866 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -14,11 +14,9 @@ dependencies = [
"anyio>=3.5.0, <5",
"distro>=1.7.0, <2",
"sniffio",
- "cached-property; python_version < '3.8'",
- "tokenizers >= 0.13.0",
"jiter>=0.4.0, <1",
]
-requires-python = ">= 3.7"
+requires-python = ">= 3.9"
classifiers = [
"Typing :: Typed",
"Intended Audience :: Developers", I had to bump the
|
If anyone needs a workaround for this in order to run software on Python 3.13 that depends on this library you can install my branch like this: python -m pip install https://github.com/simonw/anthropic-sdk-python/archive/9c13bb441ee4eb88a100ed363fc431ec8fd30c43.zip |
This should be fixed in the latest release!
|
One of the
anthropic
dependencies is not yet available for Python 3.13 -tokenizers
needspyo3-ffi
and that's not on Python 3.13 yet:This means nothing that runs Python 3.13 can
pip install anthropic
right now.Is the
tokenizers
dependency really necessary? I think it's only there for a VERY old count tokens feature which isn't actually that useful because it still uses the Claude 2 tokenizer:anthropic-sdk-python/src/anthropic/_client.py
Lines 270 to 286 in cd80d46
The text was updated successfully, but these errors were encountered: