mirror of
https://github.com/ollama/ollama-python.git
synced 2026-07-21 09:05:23 -04:00
import ollama error when os.environ["HTTP_PROXY"] = "socks5h://xxx" #202
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 @wugifer on GitHub (Jan 17, 2025).
I use ollama in a proxy environment, so os.environ["HTTP_PROXY"] = "socks5h://xxx", But
I use this code to create ollama client, so I can control the proxy:
client = ollama.Client(host="http://127.0.0.1:11434", trust_env = False)
But in ollama/__init__.py, this code cause error:
_client = Client()
the error is:
ValueError: Unknown scheme for proxy URL URL('socks5h://
cause by this judge:
if url.scheme not in ("http", "https", "socks5"):
So, my question is, could:
@zdposter commented on GitHub (Jan 29, 2025):
If you do not need to use proxy for reaching ollama, set evn. variable for ignoring localhost:
@wugifer commented on GitHub (Feb 6, 2025):
Thank you, but not work. My Problem is not "not need to use proxy", but "import ollama" error, below is error stack:
CODE1 call Client() without any args, and CODE2 call Proxy(url="socks5h://xxx") if get_environment_proxies() found one(whether used or not used), then ValueError
CODE1 is only used to set variables generate, chat, ...
change it to
will set variables to same result, and no ValueError
thanks
@wugifer commented on GitHub (Feb 7, 2025):
httpx >= 0.28.0 support socks5h
done