[GH-ISSUE #7291] ollama._types.ResponseError #51146

Closed
opened 2026-04-28 18:37:04 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @1214summer on GitHub (Oct 21, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/7291

What is the issue?

~~ python test.py
import ollama
res=ollama.chat(model="qwen2.5:0.5b",stream=False,messages=[{"role": "user","content": "who are you"}],options={"temperature":0})
print(res)

Traceback (most recent call last):
File "xxxxx", line 2, in
res=ollama.chat(model="qwen2.5:0.5b",stream=False,messages=[{"role": "user","content": "who are you"}],options={"temperature":0})
File "xxxxx/lib/python3.10/site-packages/ollama/_client.py", line 236, in chat
return self._request_stream(
File "xxxxx/lib/python3.10/site-packages/ollama/_client.py", line 99, in _request_stream
return self._stream(*args, **kwargs) if stream else self._request(*args, **kwargs).json()
File "xxxxx/lib/python3.10/site-packages/ollama/_client.py", line 75, in _request
raise ResponseError(e.response.text, e.response.status_code) from None
ollama._types.ResponseError

Why can't my Python code access the locally running Ollama?

curl http://localhost:11434/api/chat -d '{
"model": "qwen2.5:0.5b",
"messages": [
{ "role": "user", "content": "why is the sky blue?" }
]
}'

but this way can work

OS

Linux

GPU

Nvidia

CPU

AMD

Ollama version

0.3.13

Originally created by @1214summer on GitHub (Oct 21, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/7291 ### What is the issue? ~~ python test.py import ollama res=ollama.chat(model="qwen2.5:0.5b",stream=False,messages=[{"role": "user","content": "who are you"}],options={"temperature":0}) print(res) Traceback (most recent call last): File "xxxxx", line 2, in <module> res=ollama.chat(model="qwen2.5:0.5b",stream=False,messages=[{"role": "user","content": "who are you"}],options={"temperature":0}) File "xxxxx/lib/python3.10/site-packages/ollama/_client.py", line 236, in chat return self._request_stream( File "xxxxx/lib/python3.10/site-packages/ollama/_client.py", line 99, in _request_stream return self._stream(*args, **kwargs) if stream else self._request(*args, **kwargs).json() File "xxxxx/lib/python3.10/site-packages/ollama/_client.py", line 75, in _request raise ResponseError(e.response.text, e.response.status_code) from None ollama._types.ResponseError Why can't my Python code access the locally running Ollama? curl http://localhost:11434/api/chat -d '{ "model": "qwen2.5:0.5b", "messages": [ { "role": "user", "content": "why is the sky blue?" } ] }' but this way can work ### OS Linux ### GPU Nvidia ### CPU AMD ### Ollama version 0.3.13
GiteaMirror added the pythonbug labels 2026-04-28 18:37:05 -05:00
Author
Owner

@mokby commented on GitHub (Oct 25, 2024):

same error, have you solved it?

<!-- gh-comment-id:2436982807 --> @mokby commented on GitHub (Oct 25, 2024): same error, have you solved it?
Author
Owner

@ElectorShx commented on GitHub (Oct 28, 2024):

close your vpn and try again

<!-- gh-comment-id:2441988488 --> @ElectorShx commented on GitHub (Oct 28, 2024): close your vpn and try again
Author
Owner

@ghlxstar commented on GitHub (Nov 30, 2024):

close your vpn and try again

That's right, thank you

<!-- gh-comment-id:2508851865 --> @ghlxstar commented on GitHub (Nov 30, 2024): > close your vpn and try again That's right, thank you
Author
Owner

@ParthSareen commented on GitHub (Dec 2, 2024):

Seems to be a VPN issue - closing for now. Feel free to re-open if you run into this!

<!-- gh-comment-id:2510821995 --> @ParthSareen commented on GitHub (Dec 2, 2024): Seems to be a VPN issue - closing for now. Feel free to re-open if you run into this!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#51146