mirror of
https://github.com/ollama/ollama-python.git
synced 2026-07-21 09:05:23 -04:00
Python 3.12.2 Cannot import ollama #54
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 @Ray0907 on GitHub (Mar 12, 2024).
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
@hanov commented on GitHub (Mar 28, 2024):
@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 on GitHub (May 22, 2024):
The ollama python api takes much longer time than ollama command line.
why is that?
@Albert337 commented on GitHub (May 28, 2024):
when i use ollama python api, i meet the eroor as following

What I'm thinking is that the LLM model hasn't been called yet, is there any suggestions?Thanks
@wyctorfogos commented on GitHub (Sep 21, 2024):
I've just uninstalled with 'pip uninstall ollama' and install again with 'pip3'. Also, I renamed my file and it works.
@ahmetkarakaya commented on GitHub (Oct 7, 2024):
python. what a language it is. renaming works.
@naitik2314 commented on GitHub (Jan 17, 2025):
Short answer: conda install conda-forge::ollama doesn't work, as resolved by wyctorfogos, uninstall using conda remove ollama (if installed using conda), then use pip3 install ollama
Long answer: I installed using conda first (as I prefer using conda venv for my projects), and after installation was successful, even running conda list shows ollama, import ollama didn't work (even after restart), unsinstalled using conda remove ollama, installed using pip3 install ollama, works like a charm.
@ParthSareen commented on GitHub (Feb 13, 2025):
Closing this out - seems like it was a naming issue with filename. Python is such a fun language.
@cuicq commented on GitHub (Mar 27, 2025):
I finally got running