mirror of
https://github.com/ollama/ollama-python.git
synced 2026-07-21 09:05:23 -04:00
Ollama Python client mostly broken on Windows 11 #227
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 @maglore9900 on GitHub (Feb 26, 2025).
Most of the ollama client functions appear to be broken only on Windows. I first learned of a potential issue from a user in the Ollama discord about 48 hours ago.
However, I didnt see the issue (as I do not normally use the python client) until I tried to test out the Minion stuff mentioned in today's announcement.
I tested the following examples:
TEST 1
The above code results in:
TEST 2
This succeeds
TEST 3
The above code results in
ADDITIONAL INFO:
I tested in both command shell and powershell, results are the same, but command shows less verbose errors
I checked the server and app logs, no issues found.
I used
ollama run llama3.2:3bon the same machine from powershell and it worked fineOne thing I noticed was that when using ollama CLI the server log updates, but I didnt see it update from the ollama client. (not sure about the successful one)
I also tested the exact same code on Ubuntu and they all succeeded
@xuzexin-hz commented on GitHub (Mar 5, 2025):
error:httpcore.ConnectError: [WinError 10049] The requested address is not valid in its context
So you can debug and see what URL is being accessed? Or confirm the OLLAMA_HOST system variable. What is actually accessed by the ollama. ps() command http://localhost:11434/api/ps. The most effective way is debug
@maglore9900 commented on GitHub (Mar 5, 2025):
The Ollama instance is local in both test cases (windows and linux), the CLI works fine. The python client does not work on windows when you cannot specific the host (even though its local)
@lemassykoi commented on GitHub (Mar 5, 2025):
I'm using Ollama-python for months, and I never had this error. I'm always specifying host in python. The ENV variable was not used/set in my windows dev box.
I tried the TEST1 from OP, and it fails with another error :
then I read https://github.com/ollama/ollama-python/issues/450#issuecomment-2700283951 and I set the env var OLLAMA_HOST :
os.environ['OLLAMA_HOST'] = 'http://127.0.0.1:11434'after that, I ran TEST1 without error:
@ParthSareen commented on GitHub (Apr 9, 2025):
This is expected behavior - probably surfaced with the httpx bump from a bit ago.
OLLAMA_HOSTshould not be0.0.0.0from the client side.See:
https://github.com/ollama/ollama-python/pull/491#issuecomment-2790636938