Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught ImportError in utils.py line 9 #1867

Closed
jayrinaldime opened this issue Oct 1, 2024 · 3 comments
Closed

Uncaught ImportError in utils.py line 9 #1867

jayrinaldime opened this issue Oct 1, 2024 · 3 comments
Labels
question Further information is requested

Comments

@jayrinaldime
Copy link

Aider version: 0.58.1
Python version: 3.12.3
Platform: macOS-14.1.2-arm64-arm-64bit
Python implementation: CPython
Virtual environment: Yes
OS: Darwin 23.1.0 (64bit)
Git version: git version 2.30.1 (Apple Git-130)

An uncaught exception occurred:

Traceback (most recent call last):
  File "aider", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "main.py", line 537, in main
    main_model = models.Model(
                 ^^^^^^^^^^^^^
  File "models.py", line 646, in __init__
    res = self.validate_environment()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "models.py", line 845, in validate_environment
    res = litellm.validate_environment(model)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "llm.py", line 23, in __getattr__
    self._load_litellm()
  File "llm.py", line 30, in _load_litellm
    self._lazy_module = importlib.import_module("litellm")
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "__init__.py", line 9, in <module>
    from litellm.caching import Cache
  File "caching.py", line 28, in <module>
    from litellm.types.utils import all_litellm_params
  File "utils.py", line 9, in <module>
    from openai.types.completion_usage import CompletionTokensDetails, CompletionUsage
ImportError: cannot import name 'CompletionTokensDetails' from 'openai.types.completion_usage' (/Users/jr/Desktop/aiderenv/lib/python3.12/site-packages/openai/types/completion_usage.py)

@jayrinaldime
Copy link
Author

aider --model ollama/llama3.2 --no-show-model-warnings

@fry69
Copy link
Collaborator

fry69 commented Oct 1, 2024

Thank you for filing this issue.

Can you please try to install or reinstall aider in a separate Python environment? Either with venv or pipx?

Please remove the existing environment/aider installation first, e.g. with pipx:

$ pipx uninstall aider-chat
uninstalled aider-chat! ✨ 🌟 ✨
$ pipx install aider-chat
  installed package aider-chat 0.58.1, installed using Python 3.12.6
  These apps are now globally available
    - aider
done! ✨ 🌟 ✨

This document may be helpful -> https://aider.chat/docs/troubleshooting/imports.html

@fry69 fry69 added the question Further information is requested label Oct 1, 2024
@paul-gauthier
Copy link
Collaborator

Thanks for trying aider and filing this issue.

This looks like a duplicate of #1690. Please see the comments there for more information, and feel free to continue the discussion within that issue.

I'm going to close this issue for now. But please let me know if you think this is actually a distinct issue and I will reopen this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants