Closed nivit closed 3 weeks ago
Hey Nicola, thanks for this. I am not sure why this happens, can you please tell me how you installed oterm? pip? uv? Was it in a venv?
Can you try installing with
python3 -m venv .venv
source ./.venv/bin/activate
pip install oterm
in a fresh virtual environment?
Can you also check if _types.py
exists inside your environment? Can you import Parameters
from interactive python?
Hi, I use the FreeBSD ports to install oterm and its dependencies (pkg install oterm
). However installing it in a clean Python environment, as you suggested, all works fine (after applying this patch, otherwise it fails with the error:
Traceback (most recent call last):
File "/usr/home/nivit/tmp/oterm-venv/bin/oterm", line 5, in <module>
from oterm.cli.oterm import cli
File "/usr/home/nivit/tmp/oterm-venv/lib/python3.11/site-packages/oterm/cli/oterm.py", line 7, in <module>
from oterm.app.oterm import app
File "/usr/home/nivit/tmp/oterm-venv/lib/python3.11/site-packages/oterm/app/oterm.py", line 9, in <module>
from oterm.app.chat_edit import ChatEdit
File "/usr/home/nivit/tmp/oterm-venv/lib/python3.11/site-packages/oterm/app/chat_edit.py", line 17, in <module>
from oterm.ollamaclient import OllamaLLM, parse_ollama_parameters
File "/usr/home/nivit/tmp/oterm-venv/lib/python3.11/site-packages/oterm/ollamaclient.py", line 14, in <module>
from oterm.config import envConfig
File "/usr/home/nivit/tmp/oterm-venv/lib/python3.11/site-packages/oterm/config.py", line 21, in <module>
class EnvConfig:
File "/usr/home/nivit/tmp/oterm-venv/lib/python3.11/site-packages/oterm/config.py", line 32, in EnvConfig
OTERM_DATA_DIR: Path = get_default_data_dir()
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/home/nivit/tmp/oterm-venv/lib/python3.11/site-packages/oterm/utils.py", line 24, in get_default_data_dir
data_path = system_paths[sys.platform]
~~~~~~~~~~~~^^^^^^^^^^^^^^
KeyError: freebsd14
Maybe there is something wrong in the dependencies installed by FreeBSD?
The file _types
exists, but the command:python3 -c 'from ollama._types import Parameters'
fails with the reported error at the beginning.
P.S. The latest version has a very nice splash screen!
I don't know if this can help
# with Python system
Python 3.11.10 (main, Sep 14 2024, 01:05:42) [Clang 16.0.6 (https://github.com/llvm/llvm-p
roject.git llvmorg-16.0.6-0-g7cbf1a on freebsd14
Type "help", "copyright", "credits" or "license" for more information.
>>> import ollama._types
>>> dir(ollama._types)
[Any, BaseGenerateResponse, ChatResponse, GenerateResponse, Literal, Message,
NotRequired, Options, ProgressResponse, RequestError, ResponseError, Sequence,
TypedDict, __builtins__, __cached__, __doc__, __file__, __loader__, __name__
while
# in the fresh Python environment
Python 3.11.10 (main, Sep 14 2024, 01:05:42) [Clang 16.0.6 (https://github.com/llvm/llvm-p
roject.git llvmorg-16.0.6-0-g7cbf1a on freebsd14
Type "help", "copyright", "credits" or "license" for more information.
>>> import ollama._types
>>> dir(ollama._types)
[Any, BaseGenerateResponse, ChatResponse, GenerateResponse, Literal, Mapping,
Message, NotRequired, Options, Parameters, ProgressResponse, Property, Reques
Likely it's a problem with Python Ollama, not oterm
.
Mistery solved: there was an old version of ollama
under my home directory ~/.local/lib/python3.11/site-packages
. I apologize for the background noise. We can close this issue.
Oh good to know you are all set ;) And thanks for the splash I had so much fun adding this. You will also get different versions, it picks randomly among a few every time you start :)
Hi, the version 0.6.X fails to start in FreeBSD with the error:
Traceback (most recent call last): File "/usr/local/bin/oterm", line 5, in
from oterm.cli.oterm import cli
File "/usr/local/lib/python3.11/site-packages/oterm/cli/oterm.py", line 7, in
from oterm.app.oterm import app
File "/usr/local/lib/python3.11/site-packages/oterm/app/oterm.py", line 10, in
from oterm.app.chat_edit import ChatEdit
File "/usr/local/lib/python3.11/site-packages/oterm/app/chat_edit.py", line 17, in
from oterm.ollamaclient import OllamaLLM, parse_ollama_parameters
File "/usr/local/lib/python3.11/site-packages/oterm/ollamaclient.py", line 15, in
from oterm.tools import ToolDefinition
File "/usr/local/lib/python3.11/site-packages/oterm/tools/init.py", line 3, in
from ollama._types import (
ImportError: cannot import name Parameters from ollama._types (/home/nivit/.local/lib/python3.11/site-packages/ollama/_types.py)
Python version: 3.11 Python ollama version: 0.3.1.