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 _types.py line 10 #1691

Closed
arthur-brainchain opened this issue Sep 24, 2024 · 2 comments
Closed

Uncaught ImportError in _types.py line 10 #1691

arthur-brainchain opened this issue Sep 24, 2024 · 2 comments
Labels
question Further information is requested

Comments

@arthur-brainchain
Copy link

Aider version: 0.57.1
Python version: 3.11.5
Platform: macOS-14.6.1-arm64-arm-64bit
Python implementation: CPython
Virtual environment: No
OS: Darwin 23.6.0 (64bit)
Git version: git version 2.42.0

An uncaught exception occurred:

Traceback (most recent call last):
  File "base_coder.py", line 1115, in send_message
    yield from self.send(messages, functions=self.functions)
  File "base_coder.py", line 1392, in send
    hash_object, completion = send_completion(
                              ^^^^^^^^^^^^^^^^
  File "sendchat.py", line 87, in send_completion
    res = litellm.completion(**kwargs)
          ^^^^^^^^^^^^^^^^^^
  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 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "__init__.py", line 20, in <module>
    from litellm.proxy._types import (
  File "_types.py", line 10, in <module>
    from pydantic import BaseModel, ConfigDict, Extra, Field, Json, model_validator
ImportError: cannot import name 'model_validator' from 'pydantic' (/Users/arthur/anaconda3/lib/python3.11/site-packages/pydantic/__init__.cpython-311-darwin.so)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "aider", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "main.py", line 709, in main
    coder.run()
  File "base_coder.py", line 723, in run
    self.run_one(user_message, preproc)
  File "base_coder.py", line 766, in run_one
    list(self.send_message(message))
  File "base_coder.py", line 1117, in send_message
    except retry_exceptions() as err:
           ^^^^^^^^^^^^^^^^^^
  File "sendchat.py", line 24, in retry_exceptions
    litellm.exceptions.APIConnectionError,
    ^^^^^^^^^^^^^^^^^^
  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 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "__init__.py", line 20, in <module>
    from litellm.proxy._types import (
  File "_types.py", line 10, in <module>
    from pydantic import BaseModel, ConfigDict, Extra, Field, Json, model_validator
ImportError: cannot import name 'model_validator' from 'pydantic' (/Users/arthur/anaconda3/lib/python3.11/site-packages/pydantic/__init__.cpython-311-darwin.so)

@fry69
Copy link
Collaborator

fry69 commented Sep 24, 2024

Thank you for filing this issue.

At first glance this looks like you installed aider in an environment with many other Python modules and aider's dependencies got mixed up. Can you please try to install aider in a separate Python environment? Either with anaconda (which you seem to be using) or venv or even pipx?

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

@fry69 fry69 added the question Further information is requested label Sep 24, 2024
@paul-gauthier
Copy link
Owner

Thanks for trying aider and filing this issue.

This looks like a duplicate of #1437. 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