Skip to content

Fix the code request exception when OLLAMA_HOST=0.0.0.0 #491

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

xuzexin-hz
Copy link

I have been following ollma. When ollma launched the ollama-python project last year, I immediately started to use it for testing. Unfortunately, an error occurred at that time,because according to the description on https://github.com/ollama/ollama/blob/main/docs/faq.md, OLLAMA_HOST=0.0.0.0:11434, but ollama-python does not work by default.
After debugging, I found that os.environ['OLLAMA_HOST'] = 'http://127.0.0.1:11434' is required. If this configuration is used in every project, the code seems a bit redundant. Later, I also communicated with some people about this issue(issue #450、issue #455、issue #407).
Today I found that this problem still exists. Oh my God, so many people have encountered this problem, which means it is a common problem. I think we should avoid it.

@ParthSareen ParthSareen self-assigned this Apr 1, 2025
@Raekpruk
Copy link

Raekpruk commented Apr 9, 2025

Hey, I'm still running into that issue where ollama-python won't work with 0.0.0.0:11434. I'm running ollama serve with Docker. Could you share how to set OLLAMA_HOST = 'http://127.0.0.1:11434/'?

@ParthSareen
Copy link
Member

ParthSareen commented Apr 9, 2025

Hi @xuzexin-hz

Serving Ollama on 0.0.0.0 is needed to make it available, but on the client side it needs to be specified to 127.0.0.1 (or your deployed instance) to connect to Ollama. This doesn't need to be in the code, however I will look into making a comment in our docs somewhere.

@Raekpruk see related thread for help:
ollama/ollama#9422 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants