[query] Is it not possible to run ollama python library on a colab notebook ? #31

Closed
opened 2026-02-15 16:27:35 -05:00 by yindo · 2 comments
Owner

Originally created by @timtensor on GitHub (Feb 15, 2024).

Hi , I am getting some error while running ollama python library in colab notebook . Is it not possible to do so ? I am getting connection error

Perhaps it is not meant to be like that ?

Originally created by @timtensor on GitHub (Feb 15, 2024). Hi , I am getting some error while running ollama python library in colab notebook . Is it not possible to do so ? I am getting connection error Perhaps it is not meant to be like that ?
yindo closed this issue 2026-02-15 16:27:35 -05:00
Author
Owner

@connor-makowski commented on GitHub (Feb 15, 2024):

I think the intention is that Ollama is run locally on your machine. If you are using colab, then you would need to initialize a client that is connected to a running ollama model that has external connections.

I assume that running ollama on a server would involve some challenges to secure for open internet access. But assuming it is running somewhere, you could do:

from ollama import Client
client = Client(host='https://YourExternalClient.com')
response = client.chat(model='llama2', messages=[
  {
    'role': 'user',
    'content': 'Why is the sky blue?',
  },
])
@connor-makowski commented on GitHub (Feb 15, 2024): I think the intention is that Ollama is run locally on your machine. If you are using colab, then you would need to initialize a client that is connected to a running ollama model that has external connections. I assume that running ollama on a server would involve some challenges to secure for open internet access. But assuming it is running somewhere, you could do: ``` from ollama import Client client = Client(host='https://YourExternalClient.com') response = client.chat(model='llama2', messages=[ { 'role': 'user', 'content': 'Why is the sky blue?', }, ]) ```
Author
Owner

@mxyng commented on GitHub (Feb 23, 2024):

This library is intended to be the client library. It requires an running ollama instance to function. If that's what you're interested in, there's an example notebook in the ollama/ollama repo you can checkout: https://github.com/ollama/ollama/tree/main/examples/jupyter-notebook

Otherwise, it is as @connor-makowski says above.

@mxyng commented on GitHub (Feb 23, 2024): This library is intended to be the client library. It requires an running ollama instance to function. If that's what you're interested in, there's an example notebook in the ollama/ollama repo you can checkout: https://github.com/ollama/ollama/tree/main/examples/jupyter-notebook Otherwise, it is as @connor-makowski says above.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ollama/ollama-python#31