mirror of
https://github.com/ollama/ollama-python.git
synced 2026-07-21 09:05:23 -04:00
response error when calling any ollama functions #50
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Hansyvea on GitHub (Mar 10, 2024).
I have ollama service run in the background and it is working well to run any model in ternimal.
However, when it comes to python, things happend.
site-packages/ollama/_client.py:71) response.raise_for_status()
site-packages/ollama/_client.py:72) except httpx.HTTPStatusError as e:
--->site-packages/ollama/_client.py:73) raise ResponseError(e.response.text, e.response.status_code) from None
site-packages/ollama/_client.py:75) return response
@mxyng commented on GitHub (Mar 19, 2024):
Are you using the standard ollama host/port, e.g.
127.0.0.1:11434? If not, you will need to setOLLAMA_HOSTorollama.Client(host='...')@CufeDigitalEcon commented on GitHub (Apr 24, 2024):
try turn off your VPN app
@edgemoorlf commented on GitHub (Apr 25, 2024):
Thanks, buddy. You made my day!
Wondering why? REST call to http://127.0.0.1:11434/api/embeddings was ok on the same machine.
@burceasn commented on GitHub (Oct 21, 2024):
I've meet the same question, and i turn off my VPN but still not working.
Could you give me any clue?
@bsharper commented on GitHub (Jun 19, 2025):
I figured out the issue:
OLLAMA_HOSTtells the ollama server where to listen. However, there are addresses (like0.0.0.0:11434) that are valid for listeners, but invalid for requests. Listening on 0.0.0.0:11434 is valid, butcurl http://0.0.0.0:11434is invalid.This probably only happens with
OLLAMA_HOST="0.0.0.0:(any port)"Any other valid IP address would not have this problem. You could probably fix it with something likebase_url = base_url.replace('0.0.0.0', '127.0.0.1')which would do the right thing and avoid this error (I'm not aware of any time that 0.0.0.0 would refer to a non-local listener, but I could be missing something).Alternatively, you can fix it directly by setting
OLLAMA_HOSTbefore you importollama