ImportError: cannot import name 'cached_download' (or HfFolder, or any name) from 'huggingface_hub': which releases have it
cached_download was removed in huggingface_hub 0.26.0 (2024-10-18); the last release that has it is 0.25.2. HfFolder, Repository and InferenceApi were removed in 1.0.0 (2025-10-27); the last release that has them is 0.36.2. The error means a library written for an older hub is running against a newer one. Fix it by upgrading that library (diffusers 0.29.0 or later and sentence-transformers 2.3.0 or later no longer import cached_download; gradio 5.8.0 or later and datasets 2.16.0 or later no longer import HfFolder), or by pinning the hub below the release that dropped the name: pip install "huggingface_hub<0.26.0" or "huggingface_hub<1.0.0". For any other name, paste the error below.
Corrected on 2026-12-05: this page said is_offline_mode is in huggingface_hub from 1.3.0 (2026-01-09). It is there from 1.2.1 (2025-12-05); 1.2.0 does not have it. The page reads only the first release of each minor version, so a name added in a patch release was dated to the next minor. Reading every release once found 34 names whose presence in some patch release differs from the first release of the same minor (13 after the 0.0.x series); the lookup and the table now list those patch releases. The per-minor ranges themselves are unchanged.
Examples:
Runs in your browser on data.json (44 KB); nothing you paste is sent anywhere. Covers huggingface_hub, huggingface_hub.utils and huggingface_hub.errors: 568 top-level names, 519 of them in 2.4.0.
Which huggingface_hub does my diffusers, sentence-transformers, gradio, datasets or peft need?
Each library version imports a fixed set of hub names at module level, and those names fix the range of hub releases with which all of its files import. "At least" is the newest first-release among the names it imports; "below" is the first hub release that dropped one of them. The name in parentheses is the one that sets the limit. The range is about imports only: a library's own dependency declaration can be narrower, and pip follows that.
| Library | Versions | huggingface_hub at least | huggingface_hub below |
|---|---|---|---|
| diffusers | 0.0.2 | ≥ 0.1.0 (model_info) | < 1.0.0 (HfFolder) |
| 0.1.0 to 0.2.x | ≥ 0.1.0 (Repository) | < 0.26.0 (cached_download) | |
| 0.3.0 to 0.11.x | ≥ 0.8.1 (EntryNotFoundError) | < 0.26.0 (cached_download) | |
| 0.12.0 to 0.25.x | ≥ 0.10.0 (ModelCard) | < 0.26.0 (cached_download) | |
| 0.26.0 to 0.28.x | ≥ 0.20.0 (OfflineModeIsEnabled) | < 0.26.0 (cached_download) | |
| 0.29.0 to 0.32.x | ≥ 0.21.0 (split_torch_state_dict_into_shards) | no upper limit from imports | |
| 0.33.0 to 0.39.x | ≥ 0.27.0 (DDUFEntry) | no upper limit from imports | |
| 0.40.0 | ≥ 1.23.0 (CachedRepoTreeNotFoundError) | no upper limit from imports | |
| 0.41.0 to 0.43.x | ≥ 1.31.0 (httpx) | no upper limit from imports | |
| sentence-transformers | 0.1.0 to 1.2.x | any | no upper limit from imports |
| 2.0.0 to 2.2.x | ≥ 0.1.0 (Repository) | < 0.26.0 (cached_download) | |
| 2.3.0 to 2.7.x | ≥ 0.1.0 (hf_hub_download) | no upper limit from imports | |
| 3.0.0 to 6.3.x | ≥ 0.10.0 (CardData) | no upper limit from imports | |
| gradio | 3.0.25 to 3.20.x | any | no upper limit from imports |
| 3.21.0 to 3.23.x | ≥ 0.13.0 (send_telemetry) | no upper limit from imports | |
| 3.24.0 to 4.8.x | ≥ 0.8.1 (CommitOperationAdd) | no upper limit from imports | |
| 4.9.0 to 4.16.x | ≥ 0.8.1 (CommitOperationAdd) | < 1.0.0 (HfFolder) | |
| 4.17.0 to 4.44.x | ≥ 0.15.0 (InferenceClient) | < 1.0.0 (HfFolder) | |
| 5.0.0 to 5.7.x | ≥ 0.22.0 (ImageClassificationOutputElement) | < 1.0.0 (HfFolder) | |
| 5.8.0 to 6.6.x | ≥ 0.22.0 (ImageClassificationOutputElement) | no upper limit from imports | |
| 6.7.0 to 6.32.x | ≥ 0.23.0 (HFValidationError) | no upper limit from imports | |
| datasets | 1.0.0 to 1.12.x | any | no upper limit from imports |
| 1.13.0 to 2.13.x | any | < 1.0.0 (HfFolder) | |
| 2.14.0 to 2.15.x | ≥ 0.14.0 (HfFileSystem) | < 1.0.0 (HfFolder) | |
| 2.16.0 to 3.0.x | ≥ 0.14.0 (HfFileSystem) | no upper limit from imports | |
| 3.1.0 to 5.0.x | ≥ 0.20.0 (OfflineModeIsEnabled) | no upper limit from imports | |
| 5.1.0 to 5.2.x | ≥ 1.31.0 (httpx) | no upper limit from imports | |
| peft | 0.0.1 | any | no upper limit from imports |
| 0.1.0 to 0.3.x | ≥ 0.1.0 (hf_hub_download) | no upper limit from imports | |
| 0.4.0 to 0.5.x | ≥ 0.10.0 (get_hf_file_metadata) | no upper limit from imports | |
| 0.6.0 | ≥ 0.10.0 (ModelCard) | no upper limit from imports | |
| 0.7.0 to 0.12.x | ≥ 0.17.0 (file_exists) | no upper limit from imports | |
| 0.13.0 | ≥ 0.23.0 (HFValidationError) | no upper limit from imports | |
| 0.14.0 to 0.22.x | ≥ 0.25.0 (EntryNotFoundError) | no upper limit from imports |
Read at the first release of each minor version of each library (331 releases; newest read: diffusers 0.43.0, sentence-transformers 6.3.0, gradio 6.32.0, datasets 5.2.0, peft 0.22.0). "0.28.x" means the 0.28 series. An import inside a try block, a function, if TYPE_CHECKING: or an if on the installed hub version (datasets 4.8.0 to 5.0.x) is not counted, because it does not stop the library from importing. All files of the package are counted, including ones a library loads only on demand (diffusers loads most pipeline files that way), so "at least" can be stricter than what a plain import of the library needs; "below" for cached_download and HfFolder is confirmed by the public error reports linked under Sources.
Which release has the names people ask about most?
The table gives the releases that export each name, the replacement named by the library's own deprecation message, and the libraries that import the name. "Through" is the last patch release before the name disappeared.
| Name | In 2.4.0 | Releases that have it |
|---|---|---|
cached_downloadhuggingface_hub | gone | 0.0.1 through 0.25.2; gone in 0.26.0 (2024-10-18) Instead: hf_hub_download (its deprecation message: "Use `hf_hub_download` instead."). It takes a repo id and a file name, not a URL.Imported at module level by: diffusers 0.1.0 to 0.28.x, not from 0.29.0; sentence-transformers 2.0.0 to 2.2.x, not from 2.3.0. |
HfFolderhuggingface_hub | gone | 0.0.1 through 0.36.2; gone in 1.0.0 (2025-10-27) Instead: login() to store a token (the note in its source: "Use `huggingface_hub.login` instead") and get_token() to read one.Imported at module level by: datasets 1.13.0 to 2.15.x, not from 2.16.0; diffusers 0.0.2 to 0.24.x, not from 0.25.0; gradio 4.9.0 to 5.7.x, not from 5.8.0; sentence-transformers 2.0.0 to 2.2.x, not from 2.3.0. |
Repositoryhuggingface_hub | gone | 0.1.0 through 0.36.2; gone in 1.0.0 (2025-10-27) Instead: the HTTP-based methods of HfApi, such as upload_file, upload_folder and snapshot_download (its docstring: "deprecated in favor of the http-based alternatives implemented in `HfApi`").Imported at module level by: diffusers 0.1.0 to 0.9.x, not from 0.10.0; sentence-transformers 2.0.0 to 2.2.x, not from 2.3.0. Patch releases: 0.0.5 to 0.0.19 (from 2021-03-02) have it; 0.0.1 does not. |
InferenceApihuggingface_hub | gone | 0.1.0 through 0.36.2; gone in 1.0.0 (2025-10-27) Instead: InferenceClient (its deprecation message: "deprecated in favor of the more feature-complete `InferenceClient`").Patch releases: 0.0.14 to 0.0.19 (from 2021-07-16) have it; 0.0.1 does not. |
ModelFilterhuggingface_hub | gone | 0.4.0 through 0.23.5; gone in 0.24.0 (2024-07-18) Instead: pass the filter parameters as keyword arguments directly to list_models (its deprecation message). |
DatasetFilterhuggingface_hub | gone | 0.4.0 through 0.23.5; gone in 0.24.0 (2024-07-18) Instead: pass the filter parameters as keyword arguments directly to list_datasets (its deprecation message). |
ModelSearchArgumentshuggingface_hub | gone | 0.4.0 through 0.18.0; gone in 0.19.0 (2023-11-08) |
update_repo_visibilityhuggingface_hub | gone | 0.1.0 through 0.36.2; gone in 1.0.0 (2025-10-27) Instead: update_repo_settings (its deprecation message). |
configure_http_backendhuggingface_hub | gone | 0.14.0 through 0.36.2; gone in 1.0.0 (2025-10-27) |
list_files_infohuggingface_hub | gone | 0.14.0 through 0.22.2; gone in 0.23.0 (2024-05-02) |
hf_hub_downloadhuggingface_hub | imports | from 0.1.0 (2021-11-02), still in 2.4.0 Patch releases: 0.0.11 to 0.0.19 (from 2021-06-23) have it; 0.0.1 does not. |
snapshot_downloadhuggingface_hub | imports | from 0.1.0 (2021-11-02), still in 2.4.0 Patch releases: 0.0.8 to 0.0.19 (from 2021-04-07) have it; 0.0.1 does not. |
InferenceClienthuggingface_hub | imports | from 0.15.0 (2023-06-01), still in 2.4.0 |
get_tokenhuggingface_hub | imports | from 0.20.0 (2023-12-20), still in 2.4.0 |
split_torch_state_dict_into_shardshuggingface_hub | imports | from 0.21.0 (2024-02-27), still in 2.4.0 |
DDUFEntryhuggingface_hub | imports | from 0.27.0 (2024-12-16), still in 2.4.0 |
HfFileSystemhuggingface_hub | imports | from 0.14.0 (2023-04-24), still in 2.4.0 |
file_existshuggingface_hub | imports | from 0.17.0 (2023-09-11), still in 2.4.0 |
list_repo_treehuggingface_hub | imports | from 0.20.0 (2023-12-20), still in 2.4.0 |
is_offline_modehuggingface_hub | imports | from 1.3.0 (2026-01-09), still in 2.4.0 Patch releases: 1.2.1 to 1.2.4 (from 2025-12-05) have it; 1.2.0 does not. |
hf_raise_for_statushuggingface_hub | imports | from 1.0.0 (2025-10-27), still in 2.4.0 |
set_client_factoryhuggingface_hub | imports | from 1.0.0 (2025-10-27), still in 2.4.0 |
OfflineModeIsEnabledhuggingface_hub.utils | imports | from 0.20.0 (2023-12-20), still in 2.4.0 |
HfHubHTTPErrorhuggingface_hub.utils | imports | from 0.10.0 (2022-09-28), still in 2.4.0 |
EntryNotFoundErrorhuggingface_hub.utils | imports | from 0.8.1 (2022-06-21), still in 2.4.0 |
HfFolderhuggingface_hub.utils | gone | 0.10.0 through 0.36.2; gone in 1.0.0 (2025-10-27) Instead: huggingface_hub.login() to store a token and huggingface_hub.get_token() to read one. |
is_hf_transfer_availablehuggingface_hub.utils | gone | 0.12.0 through 0.36.2; gone in 1.0.0 (2025-10-27) |
httpxhuggingface_hub.utils | imports | from 1.31.0 (2026-09-10), still in 2.4.0 |
EntryNotFoundErrorhuggingface_hub.errors | imports | from 0.25.0 (2024-09-17), still in 2.4.0 |
RepositoryNotFoundErrorhuggingface_hub.errors | imports | from 0.25.0 (2024-09-17), still in 2.4.0 |
HfHubHTTPErrorhuggingface_hub.errors | imports | from 0.25.0 (2024-09-17), still in 2.4.0 |
OfflineModeIsEnabledhuggingface_hub.errors | imports | from 0.23.0 (2024-05-02), still in 2.4.0 |
HFValidationErrorhuggingface_hub.errors | imports | from 0.23.0 (2024-05-02), still in 2.4.0 |
What did each huggingface_hub release remove?
49 of the 568 top-level names are gone from 2.4.0; this is every one of them, by the release that dropped it. Most are generated inference types that were renamed; the ones that break other libraries are in 0.26.0 and 1.0.0.
| Release | Date (PyPI) | Names | Gone from the top level |
|---|---|---|---|
| 2.0.0 | 2026-09-24 | 5 | delete_space_storage, duplicate_space, repo_type_and_id_from_hf_id, request_space_storage, upload_large_folder |
| 1.3.0 | 2026-01-09 | 1 | offline_mode |
| 1.0.0 | 2025-10-27 | 12 | HfFolder, InferenceApi, KerasModelHubMixin, Repository, configure_http_backend, from_pretrained_keras, get_tf_storage_size, get_token_permission, push_to_hub_keras, save_pretrained_keras, split_tf_state_dict_into_shards, update_repo_visibilitythe git-based Repository, the legacy InferenceApi, HfFolder, the Keras and TensorFlow helpers, and the requests-based configure_http_backend |
| 0.32.0 | 2025-05-23 | 1 | ChatCompletionInputGrammarTypeType |
| 0.29.0 | 2025-02-19 | 1 | TextToImageTargetSize |
| 0.28.0 | 2025-01-28 | 1 | like |
| 0.27.0 | 2024-12-16 | 9 | ChatCompletionInputToolType, MultiCommitException, ToolElement, ZeroShotClassificationInputData, ZeroShotImageClassificationInputData, ZeroShotObjectDetectionInputData, create_commits_on_pr, list_metrics, plan_multi_commits |
| 0.26.0 | 2024-10-18 | 5 | ChatCompletionInputTool, ChatCompletionInputToolTypeClass, SummarizationGenerationParameters, TranslationGenerationParameters, cached_downloadcached_download and four generated inference types |
| 0.24.0 | 2024-07-18 | 4 | ChatCompletionInputToolCall, DatasetFilter, ModelFilter, split_numpy_state_dict_into_shards |
| 0.23.0 | 2024-05-02 | 7 | ChatCompletionOutputChoice, ChatCompletionOutputChoiceMessage, TextGenerationOutputSequenceDetails, TextGenerationParameters, TextGenerationPrefillToken, TextGenerationStreamDetails, list_files_info |
| 0.19.0 | 2023-11-08 | 2 | DatasetSearchArguments, ModelSearchArguments |
| 0.14.0 | 2023-04-24 | 2 | set_access_token, unset_access_token |
| 0.10.0 | 2022-09-28 | 2 | login, logout |
| 0.5.0 | 2022-04-05 | 1 | list_repos_objs |
login and logout are listed at 0.10.0 because that release did not export them; they are back from 0.11.0 and are in 2.4.0.
How do I read the error?
- The traceback names the file that asked for the name, a few lines above the error. If it is inside
site-packages/diffusers/,sentence_transformers/,gradio/or another library, that library is older than your hub: upgrade it, or pin the hub. - The path in parentheses is the copy of huggingface_hub that was imported. Check that it is the version you expect:
python -c "import huggingface_hub as h; print(h.__version__, h.__file__)". - On a Space, the hub version is whatever the Space's SDK and
requirements.txtresolve to at build time, so an app that worked can break on a rebuild. Pinhuggingface_hubinrequirements.txt, or raise the pins of the libraries that import the old name. - "Did you mean: 'hf_hub_download'?" at the end is Python's spelling suggestion, not advice from the library; for
cached_downloadit happens to name the real replacement.
How was this read, and how was it checked?
From the source of each release tag, with Python's ast module; no release was installed or imported.
- huggingface_hub up to 0.7.x imports its names eagerly in
__init__.py; from 0.8.1 the top level is lazy and serves the names of one table (_SUBMOD_ATTRS), which is read. The module-level__getattr__has no other rule; the build stops if a release adds one. huggingface_hub.utilsandhuggingface_hub.errors: the names the module binds, plus the lazy table ofutilswhere it has one.- The five libraries: every
.pyfile of the package at the first release of each minor version, looking forfrom huggingface_hub import ...,from huggingface_hub.utils import ...andfrom huggingface_hub.errors import ...at module level. - Dates and yanked releases come from PyPI. Where the
.0release of a minor version was yanked or never uploaded, the first release pip installs is used.
Checks, all by a second reading: (1) every lazy release carries a generated static copy of its table for type checkers; in all 66 lazy releases that have one, the copy and our reading are identical (66 of 66). (2) For each of the 8 "library imports a removed name" ranges, a plain-text search of the library's files finds the import at both ends of the range and no module-level import in the version after it. (3) 16 facts from deprecation messages and release notes hold (for example cached_download carries @_deprecate_method(version="0.26") in 0.25.0 and is gone in 0.26.0).
Limits
- Nothing was installed or run. The library ranges say which hub releases let the library's files import; they do not say every feature works across that range.
- The ranges use the first release of each minor version, for the hub and for the libraries. For the hub, every release was also read once (patch_check.py, 205 releases, from the wheels on PyPI): 34 names differ in some patch release from the first release of their minor, 13 of them after 0.0.x (all 0.0.x releases count as one minor here). The lookup and the table print those patch releases under the range. The five libraries were not read patch by patch.
- A module-level import in a file that the library itself only loads on demand does not break
import library, only the feature that loads that file. The lookup names one such file per range in data.json. - Submodules of the hub other than
utilsanderrorsare not covered (huggingface_hub.constants,huggingface_hub.file_download,huggingface_hub.inferenceand so on), and libraries other than the five are not read. - "Instead" is given only where the hub's own deprecation message or docstring names a replacement.
Questions
Which huggingface_hub version removed cached_download?
huggingface_hub 0.26.0 (2024-10-18). cached_download is importable through 0.25.2. Its deprecation message names the replacement: hf_hub_download, which takes a repo id and a file name where cached_download took a URL.
How do I fix "cannot import name 'cached_download' from 'huggingface_hub'" with diffusers or sentence-transformers?
Upgrade the library that asks for it: diffusers imports cached_download at module level from 0.1.0 to 0.28.x and stops in 0.29.0, sentence-transformers from 2.0.0 to 2.2.x and stops in 2.3.0. If you cannot upgrade it, pin the hub instead: pip install "huggingface_hub<0.26.0" (0.25.2 is the last release that has the name).
Why can't I import HfFolder from huggingface_hub?
huggingface_hub 1.0.0 (2025-10-27) removed HfFolder; 0.36.2 is the last release that has it. Use login() to store a token and get_token() to read one. gradio imports HfFolder at module level from 4.9.0 to 5.7.x and stops in 5.8.0; datasets from 1.13.0 to 2.15.x and stops in 2.16.0.
How do I fix "cannot import name 'BucketNotFoundError' from 'huggingface_hub.errors'"?
BucketNotFoundError first appears in huggingface_hub 1.5.0 (2026-02-26). datasets 5.1.0 and later import it at module level and declare huggingface-hub>=1.31.0, so the error means the hub was kept older than 1.5.0, often below 1.0 for transformers 4.x. Upgrade the hub (pip install -U "huggingface_hub>=1.31.0"), or, if it has to stay on 0.x, use datasets 5.0.1: 4.8.0 to 5.0.1 import the name only when the installed hub is 1.6.0 or newer.
Does pinning huggingface_hub break anything else?
It can. Newer releases of the same libraries import names that old hub releases do not have: for example diffusers 0.33.0 and later need huggingface_hub 0.27.0 or newer for DDUFEntry. Pick a hub release inside the range of every library you have installed; the table on this page gives that range per library version.
The name in my error is not cached_download or HfFolder. Does this page cover it?
Yes. The lookup covers every name that huggingface_hub, huggingface_hub.utils and huggingface_hub.errors have exported from 0.0.1 to 2.4.0: 568 top-level names, of which 49 are gone from the newest release.
Sources
- huggingface/huggingface_hub, release tags v0.0.1 to v2.4.0: src/huggingface_hub/__init__.py, utils/__init__.py, errors.py.
- Deprecation messages quoted for replacements: file_download.py at 0.25.0 (
cached_download), inference_api.py at 0.36.0, repository.py at 0.36.0, utils/_hf_folder.py at 0.36.0, utils/endpoint_helpers.py at 0.23.0 (ModelFilter,DatasetFilter), hf_api.py at 0.36.0 (update_repo_visibility). - Release tags of huggingface/diffusers, UKPLab/sentence-transformers, gradio-app/gradio, huggingface/datasets and huggingface/peft; release dates from PyPI.
- Reports of the error this page answers: a Space fixed by changing requirements.txt, a Space pinning huggingface_hub==0.25.2, HfFolder with Gradio.
The same data as JSON: data.json, licensed CC BY 4.0.
Related: "cannot import name ... from 'transformers'": the releases that have each name · "got an unexpected keyword argument": PEFT, TRL and TrainingArguments by version · "does not recognize this architecture": the version each model needs.