Skip to content

ImportError: cannot import name 'HfFolder' from 'huggingface_hub' #7284

Description

@Code4SAFrankie

Describe the bug

When installing with your own Python venv on Windows 11 with an RTX4090, I get the error

Is there an existing issue for this?

  • I have searched the existing issues

Reproduction

Clone repository

git clone https://github.com/oobabooga/text-generation-webui
cd text-generation-webui

Create virtual environment

python -m venv venv

Activate virtual environment

On Windows:

venv\Scripts\activate

On macOS/Linux:

source venv/bin/activate

Install dependencies (choose appropriate file under requirements/portable for your hardware)

pip install -r requirements/portable/requirements.txt --upgrade

Launch server (basic command)

python server.py --portable --api --auto-launch

Screenshot

No response

Logs

(TextGenWebUI) D:\text-generation-webui>python server.py --portable --api --auto-launchcls
╭──────────────────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────────────────╮
│ D:\text-generation-webui\server.py:6 in <module>                                                                                           │
│                                                                                                                                            │
│     5                                                                                                                                      │
│ ❱   6 from modules import shared                                                                                                           │
│     7 from modules.block_requests import OpenMonkeyPatch, RequestBlocker                                                                   │
│                                                                                                                                            │
│ D:\text-generation-webui\modules\shared.py:12 in <module>                                                                                  │
│                                                                                                                                            │
│    11 from modules.logging_colors import logger                                                                                            │
│ ❱  12 from modules.presets import default_preset                                                                                           │
│    13                                                                                                                                      │
│                                                                                                                                            │
│ D:\text-generation-webui\modules\presets.py:8 in <module>                                                                                  │
│                                                                                                                                            │
│     7 from modules import shared                                                                                                           │
│ ❱   8 from modules.loaders import loaders_samplers                                                                                         │
│     9 from modules.logging_colors import logger                                                                                            │
│                                                                                                                                            │
│ D:\text-generation-webui\modules\loaders.py:4 in <module>                                                                                  │
│                                                                                                                                            │
│     3                                                                                                                                      │
│ ❱   4 import gradio as gr                                                                                                                  │
│     5                                                                                                                                      │
│                                                                                                                                            │
│ C:\Program Files\Python312\MyVenvs\TextGenWebUI\Lib\site-packages\gradio\__init__.py:3 in <module>                                         │
│                                                                                                                                            │
│     2                                                                                                                                      │
│ ❱   3 import gradio._simple_templates                                                                                                      │
│     4 import gradio.image_utils                                                                                                            │
│                                                                                                                                            │
│                                                          ... 6 frames hidden ...                                                           │
│                                                                                                                                            │
│ C:\Program Files\Python312\MyVenvs\TextGenWebUI\Lib\site-packages\gradio\networking.py:14 in <module>                                      │
│                                                                                                                                            │
│   13                                                                                                                                       │
│ ❱ 14 from gradio.routes import App  # HACK: to avoid circular import # noqa: F401                                                          │
│   15 from gradio.tunneling import Tunnel                                                                                                   │
│                                                                                                                                            │
│ C:\Program Files\Python312\MyVenvs\TextGenWebUI\Lib\site-packages\gradio\routes.py:69 in <module>                                          │
│                                                                                                                                            │
│     68 import gradio                                                                                                                       │
│ ❱   69 from gradio import ranged_response, route_utils, utils, wasm_utils                                                                  │
│     70 from gradio.context import Context                                                                                                  │
│                                                                                                                                            │
│ C:\Program Files\Python312\MyVenvs\TextGenWebUI\Lib\site-packages\gradio\route_utils.py:46 in <module>                                     │
│                                                                                                                                            │
│    45 from gradio.exceptions import Error                                                                                                  │
│ ❱  46 from gradio.helpers import EventData                                                                                                 │
│    47 from gradio.state_holder import SessionState                                                                                         │
│                                                                                                                                            │
│ C:\Program Files\Python312\MyVenvs\TextGenWebUI\Lib\site-packages\gradio\helpers.py:25 in <module>                                         │
│                                                                                                                                            │
│     24                                                                                                                                     │
│ ❱   25 from gradio import components, oauth, processing_utils, routes, utils, wasm_utils                                                   │
│     26 from gradio.context import Context, LocalContext, get_blocks_context                                                                │
│                                                                                                                                            │
│ C:\Program Files\Python312\MyVenvs\TextGenWebUI\Lib\site-packages\gradio\oauth.py:12 in <module>                                           │
│                                                                                                                                            │
│    11 from fastapi.responses import RedirectResponse                                                                                       │
│ ❱  12 from huggingface_hub import HfFolder, whoami                                                                                         │
│    13                                                                                                                                      │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
ImportError: cannot import name 'HfFolder' from 'huggingface_hub' (C:\Program
Files\Python312\MyVenvs\TextGenWebUI\Lib\site-packages\huggingface_hub\__init__.py)

System Info

Windows 11, Nvidia RTX 4090

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions