Uncaught AttributeError in sendchat.py line 30
Aider version: 0.55.0 Python version: 3.11.5 Platform: Windows-10-10.0.22621-SP0 Python implementation: CPython Virtual environment: No OS: Windows 10 (64bit) Git version: git version 2.42.0.windows.2
An uncaught exception occurred:
Traceback (most recent call last):
File "openai.py", line 1025, in completion
raise e
File "openai.py", line 902, in completion
return self.streaming(
^^^^^^^^^^^^^^^
File "openai.py", line 1143, in streaming
openai_client = self._get_openai_client(
^^^^^^^^^^^^^^^^^^^^^^^^
File "openai.py", line 742, in _get_openai_client
_new_client = OpenAI(
^^^^^^^
File "_client.py", line 105, in __init__
raise OpenAIError(
openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 1378, in completion
raise e
File "main.py", line 1351, in completion
response = openai_chat_completions.completion(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "openai.py", line 1032, in completion
raise OpenAIError(
litellm.llms.OpenAI.openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "base_coder.py", line 1105, in send_message
yield from self.send(messages, functions=self.functions)
File "base_coder.py", line 1377, in send
hash_object, completion = send_completion(
^^^^^^^^^^^^^^^^
File "sendchat.py", line 86, in send_completion
res = litellm.completion(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "utils.py", line 1092, in wrapper
raise e
File "utils.py", line 980, in wrapper
result = original_function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "main.py", line 2802, in completion
raise exception_type(
^^^^^^^^^^^^^^^
File "utils.py", line 8189, in exception_type
raise e
File "utils.py", line 6489, in exception_type
raise AuthenticationError(
litellm.exceptions.AuthenticationError: litellm.AuthenticationError: AuthenticationError: OpenAIException - The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "__main__.py", line 7, in <module>
sys.exit(main())
^^^^^^
File "main.py", line 694, in main
coder.run()
File "base_coder.py", line 730, in run
self.run_one(user_message, preproc)
File "base_coder.py", line 773, in run_one
list(self.send_message(message))
File "base_coder.py", line 1107, in send_message
except retry_exceptions() as err:
^^^^^^^^^^^^^^^^^^
File "sendchat.py", line 30, in retry_exceptions
litellm.llms.anthropic.AnthropicError,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'litellm.llms.anthropic' has no attribute 'AnthropicError'
Please upgrade to current version 0.56.0 with aider --upgrade
If possible use pipx to install aider to separate it from other Python libraries. pip, homebrew and system packages often mess up the dependencies.
Also note that you probably installed a more recent version of LiteLLM inside the environment where aider runs, that is not supported. aider requires LiteLLM version 1.44.7, newer versions will produce an error or exception.
This looks like a duplicate of #1278, so I'm going to close it so discussion can happen there. Please let me know if you think it's actually a distinct issue.