ollama / ollama-python

Ollama Python library
https://ollama.com
MIT License
2.71k stars 223 forks source link

Python 3.12.2 Cannot import ollama #91

Open Ray0907 opened 3 months ago

Ray0907 commented 3 months ago

I attempted to utilize the example, but encountered some errors as follows. Python 3.12.2 (main, Feb 6 2024, 20:19:44) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin

import ollama
from ollama import create
ImportError: cannot import name 'create' from partially initialized module 'ollama' (most likely due to a circular import) 
hanov commented 3 months ago

@Ray0907 rename your file from ollama.py to something different like test.py. It helped me. also keep in mind you need to install ollama with pip pip3 install ollama

ibrahim-string commented 1 month ago

The ollama python api takes much longer time than ollama command line. why is that?

Albert337 commented 1 month ago

The ollama python api takes much longer time than ollama command line. why is that?

when i use ollama python api, i meet the eroor as following image What I'm thinking is that the LLM model hasn't been called yet, is there any suggestions?Thanks