transformers - 💡(How to fix) Fix Please update `tokenizers` version check [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
huggingface/transformers#45736Fetched 2026-05-02 05:27:29
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
commented ×1labeled ×1mentioned ×1subscribed ×1

Error Message

ImportError: tokenizers>=0.22.0,<=0.23.0 is required for a normal functioning of this module, but found tokenizers==0.23.1.

Root Cause

I have made a patch to remove this check, but running make fix-repo as it suggested generates a lot of changes. And I missed some of check because of the lack of some python package.

Fix Action

Fix / Workaround

I have made a patch to remove this check, but running make fix-repo as it suggested generates a lot of changes. And I missed some of check because of the lack of some python package.

Code Example

ImportError: tokenizers>=0.22.0,<=0.23.0 is required for a normal functioning of this module, but found tokenizers==0.23.1.
RAW_BUFFERClick to expand / collapse

Feature request

Several days before, tokenizers released a new version of 0.23.1, but transformers doesn't allow us to use it.

https://github.com/huggingface/transformers/blob/ecc3d0da0f8e9c2c54676345b816db29f842792a/setup.py#L150 https://github.com/huggingface/transformers/blob/ecc3d0da0f8e9c2c54676345b816db29f842792a/src/transformers/dependency_versions_table.py#L77

And if you import transformers, you will get an error.

ImportError: tokenizers>=0.22.0,<=0.23.0 is required for a normal functioning of this module, but found tokenizers==0.23.1.

0.23.1 includes some break changes, if you have any plan to remove <=0.23.0 check?

Motivation

In Arch Linux, we use the latest version of tokenizers, making it impossible to use current version of transformers.

And 0.23.1 have improved performance that will improve transformers' performance

Your contribution

I have made a patch to remove this check, but running make fix-repo as it suggested generates a lot of changes. And I missed some of check because of the lack of some python package.

Or, I just need to edit setup.py and src/transformers/dependency_versions_table.py?

Btw, I have not tested if 0.23.1 breaks something down yet.

extent analysis

TL;DR

Update the transformers library to support tokenizers version 0.23.1 by modifying the version check in setup.py and dependency_versions_table.py.

Guidance

  • Identify the lines of code in setup.py and dependency_versions_table.py that enforce the tokenizers version check and update them to allow 0.23.1.
  • Verify that the updated transformers library works correctly with tokenizers version 0.23.1 by running tests and checking for any errors.
  • Consider testing the updated library with different use cases to ensure that the changes do not introduce any regressions.
  • If possible, submit a pull request to the transformers repository with the updated code to make the fix available to others.

Example

# In setup.py, update the line:
install_requires = [..., "tokenizers>=0.22.0,<=0.23.0",...]
# to:
install_requires = [..., "tokenizers>=0.22.0,<=0.23.1",...]

# In dependency_versions_table.py, update the line:
TOKENIZERS = ("tokenizers", ["0.22.0", "0.23.0"])
# to:
TOKENIZERS = ("tokenizers", ["0.22.0", "0.23.1"])

Notes

The fix assumes that the tokenizers version 0.23.1 is compatible with the transformers library. Thorough testing is necessary to ensure that the updated library works correctly.

Recommendation

Apply the workaround by updating the setup.py and dependency_versions_table.py files to support tokenizers version 0.23.1, as this will allow the use of the latest tokenizers version with the transformers library.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

transformers - 💡(How to fix) Fix Please update `tokenizers` version check [1 comments, 2 participants]