Skip to content
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

Fix incorrect import path in gradio/external.py causing ModuleNotFoundError #10762

Open
1 task done
xiaoyingv opened this issue Mar 8, 2025 · 0 comments
Open
1 task done
Labels
bug Something isn't working

Comments

@xiaoyingv
Copy link

Describe the bug

I am using the Gradio Python library. When running the code:

import gradio as gr

gr.load_chat("http://127.0.0.1:11434/v1/", model="deepseek-r1:8b", token="ollama").launch()
I encountered the following error:

Traceback (most recent call last):
File "C:\Users\gradio_chat\chat.py", line 3, in
gr.load_chat("http://127.0.0.1:11434/v1/", model="deepseek-r1:8b", token="ollama").launch()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\WU-GER\Desktop\gradio_chat\venv\Lib\site-packages\gradio\external.py", line 805, in load_chat
from gr.chat_interface import ChatInterface
ModuleNotFoundError: No module named 'gr'

Process finished with exit code 1
I found that the problem was due to the code in gradio>external.py file at line 805: from gr.chat_interface import ChatInterface. It was written incorrectly, and it should be:

from gradio.chat_interface import ChatInterface

Now the code runs normally.

I'm sorry, I'm not very familiar with the PR process. Could you please handle the PR? Thank you.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import gradio as gr

gr.load_chat(
    "http://127.0.0.1:11434/v1/",
    model="deepseek-r1:8b",
    token="ollama"
).launch()

Screenshot

Image
Image
Image
Image

Logs

Observe error:
ModuleNotFoundError: No module named 'gr'
  File "gradio/external.py", line 805
    from gr.chat_interface import ChatInterface

System Info

gradio environment
Gradio Environment Information:
------------------------------
Operating System: Windows
gradio version: 5.20.1
gradio_client version: 1.7.2

------------------------------------------------
gradio dependencies in your environment:

aiofiles: 23.2.1
anyio: 4.8.0
audioop-lts is not installed.
fastapi: 0.115.11
ffmpy: 0.5.0
gradio-client==1.7.2 is not installed.
groovy: 0.1.2
httpx: 0.28.1
huggingface-hub: 0.29.2
jinja2: 3.1.6
markupsafe: 2.1.5
numpy: 2.2.3
orjson: 3.10.15
packaging: 24.2
pandas: 2.2.3
pillow: 11.1.0
pydantic: 2.10.6
pydub: 0.25.1
python-multipart: 0.0.20
pyyaml: 6.0.2
ruff: 0.9.10
safehttpx: 0.1.6
semantic-version: 2.10.0
starlette: 0.46.0
tomlkit: 0.13.2
typer: 0.15.2
typing-extensions: 4.12.2
urllib3: 2.3.0
uvicorn: 0.34.0
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.


gradio_client dependencies in your environment:

fsspec: 2025.3.0
httpx: 0.28.1
huggingface-hub: 0.29.2
packaging: 24.2
typing-extensions: 4.12.2
websockets: 15.0.1

Severity

I can work around it

@xiaoyingv xiaoyingv added the bug Something isn't working label Mar 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant