mirror of
https://github.com/ollama/ollama-python.git
synced 2026-07-21 09:05:23 -04:00
Why can't I call the local Ollama model through this python library under Windows system? #225
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 @S0RA27 on GitHub (Feb 21, 2025).
Why can't I call the local Ollama model through this python library under Windows system?
this is my code:
import numpy as np
from ollama import chat, Message
import ollama
message = [
Message(role='system', content='translate zh-cn'),
Message(role='user', content='good night')
]
response = chat(model='llama3.2',messages=message)
print(response)
here is my error:
Exception has occurred: RemoteProtocolError
Server disconnected without sending a response.
httpcore.RemoteProtocolError: Server disconnected without sending a response.
The above exception was the direct cause of the following exception:
File "C:\Users\38231\Desktop\RAG\RAG_Chat.py", line 11, in
response = chat(model='llama3.2',messages=message)
httpx.RemoteProtocolError: Server disconnected without sending a response.
@ParthSareen commented on GitHub (Feb 21, 2025):
Can you verify you're able to run ollama through the terminal with
ollama run llama3.2@xuzexin-hz commented on GitHub (Mar 5, 2025):
So you can debug and see what URL is being accessed? Or confirm the OLLAMA_HOST system variable. The most effective way is to debug
@lemassykoi commented on GitHub (Mar 5, 2025):
add this to your script:
@ParthSareen commented on GitHub (Apr 9, 2025):
OLLAMA_HOSTshould not be0.0.0.0from the client side.https://github.com/ollama/ollama-python/pull/491#issuecomment-2790636938