Unable to get ollama serve working #52

Closed
opened 2026-02-15 16:27:44 -05:00 by yindo · 1 comment
Owner

Originally created by @harsham05 on GitHub (Mar 11, 2024).

I have installed Ollama on Ubuntu. I am unable to interact with it using the Ollama Python client.

$ ollama list
NAME            ID              SIZE    MODIFIED
llama2:70b      e7f6c06ffef4    38 GB   2 hours ago
llama2:latest   78e26419b446    3.8 GB  4 days ago
$ OLLAMA_HOST=127.0.0.1:7656 ollama serve

When I try to interact with ollama in Python, I get a ResponseError. Thank you in advance.

import ollama
response = ollama.chat(model='llama2', messages=[
  {
    'role': 'user',
    'content': 'Why is the sky blue?',
  },
])
print(response['message']['content'])
image
Originally created by @harsham05 on GitHub (Mar 11, 2024). I have installed Ollama on Ubuntu. I am unable to interact with it using the Ollama Python client. ``` $ ollama list NAME ID SIZE MODIFIED llama2:70b e7f6c06ffef4 38 GB 2 hours ago llama2:latest 78e26419b446 3.8 GB 4 days ago ``` ``` $ OLLAMA_HOST=127.0.0.1:7656 ollama serve ``` When I try to interact with ollama in Python, I get a ResponseError. Thank you in advance. ``` import ollama response = ollama.chat(model='llama2', messages=[ { 'role': 'user', 'content': 'Why is the sky blue?', }, ]) print(response['message']['content']) ``` <img width="1169" alt="image" src="https://github.com/ollama/ollama-python/assets/8755540/52de3430-a6e3-45fd-b392-1ff79e980f66">
yindo closed this issue 2026-02-15 16:27:44 -05:00
Author
Owner

@mxyng commented on GitHub (Mar 19, 2024):

$ OLLAMA_HOST=127.0.0.1:7656 ollama serve

Since this is a non-standard ollama port, you need to set either OLLAMA_HOST=127.0.0.1:7656 or ollama.Client(host='127.0.0.1:7656')

@mxyng commented on GitHub (Mar 19, 2024): > $ OLLAMA_HOST=127.0.0.1:7656 ollama serve Since this is a non-standard ollama port, you need to set either `OLLAMA_HOST=127.0.0.1:7656` or `ollama.Client(host='127.0.0.1:7656')`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ollama/ollama-python#52