-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
ImportError: cannot import name 'override' from 'typing_extensions' with openai==1.2.0 #751
Comments
I'm getting AzureOpenAI importing error as well :( |
@samedovzaur Can you share an example snippet / error? |
Opened a new issue called AzureOpenAI error, but let me paste it in here: import os llm = AzureOpenAI( This is the error: |
@glejdis what version of We currently require |
@RobertCraigie I have been using v4.5 |
@glejdis What does this command output for you? python -c 'from importlib.metadata import version; print(version("typing_extensions"))' |
@RobertCraigie 4.5.0 |
hmm are you running it in the same environment as your original report? What if you replace the script you had before with this? from importlib.metadata import version
print(version("typing_extensions")) |
@RobertCraigie it is still 4.5.0 and yes I am on the same environment. I am running the code as a notebook in Databricks |
Okay I'm not sure what could be causing your issue then because
It also works for me at runtime on Python 3.10.13 and Can you try upgrading to the latest |
@RobertCraigie Thank you so much for your help but I already updated the typing-extensions package to the latest version but the error is still there. |
Can you reproduce this issue outside of databricks? |
An update: I replaced "OpenAIEmbeddings" function with "AzureOpenAIEmbeddings". And the previous error did not appear anymore. However, now I receive this error: NotFoundError: Error code: 404 - {'error': {'code': '404', 'message': 'Resource not found'}} |
Could you share a Replit or similar reproduction? |
where should this change be made? |
@RobertCraigie @snehaa2632000 Here is the code def utils_embedding(input_chunk, OPENAI_API_KEY, deployment_str = "text-embedding-ada-002", api_base = "https://xxx"):
OPENAI_API_KEY = dbutils.secrets.get(scope = "tokens", key = "xxx") |
I am also getting the same issue on Databricks:
Current specs :
|
@snehaa2632000 can you try importing it yourself and if that fails, report an issue to databricks as this appears to be unrelated to the openai package. It also looks like they're doing import patching. from typing_extensions import override |
It still fails if I try importing myself. I will raise an issue to Databricks. |
The error still persists. This is the error: NotFoundError: Error code: 404 - {'error': {'code': '404', 'message': 'Resource not found'}} |
@glejdis can you share a full code snippet? The snippet you shared doesn't include imports. |
@RobertCraigie I shared it here :) |
Sorry it wasn't clear, that code doesn't include imports, I'm not sure where |
from langchain.embeddings import AzureOpenAIEmbeddings |
Okay I think this is a langchain issue then, if you aren't on the latest version I'd recommend upgrading to the latest and testing again. If it still doesn't work then please open an issue on the langchain repository. |
I'm going to close this issue as the reported ImportError is a databricks bug and the current issue isn't related to this SDK. |
This occurs in databricks runtime 13.x (and also 14.x with slightly different error), when installing openai using |
Should this be reported to databricks? Is there an issue tracker you could link to here with an issue? |
If you specify an older version of openai it works. This version was suggested by chatgpt itself and it did the trick |
after changing the openai version to 0.27.0, saw another error: |
Entered this issue in Databricks notebook as well, was able to fix it by running: |
I confirm that in runtime 13.3 ML it works like this
The "upgrade" is needed because otherwise it keeps preinstalled version 0.27.8 |
I'm now having this issue in a fairly vanilla Google Colab Notebook (it was working last week, now it isn't!) |
@davies-w if |
Using the |
hello I solve it by updating my version for typing-extensions and openai |
Just |
4.3.0 |
Yep. Worked for me too. Thanks!!! |
Hi, For me what helped is using |
Confirm this is an issue with the Python library and not an underlying OpenAI API
Describe the bug
ImportError Traceback (most recent call last)
File , line 4
2 from langchain.embeddings import OpenAIEmbeddings, AzureOpenAIEmbeddings
3 #import openai
----> 4 from openai import AzureOpenAI
5 def utils_embedding(input_chunk, OPENAI_API_KEY, deployment_str = "xxxxx, api_base = "xxxx"):
7 OPENAI_API_KEY = XXX)
File /local_disk0/.ephemeral_nfs/envs/pythonEnv-853491b7-ec2b-411d-9c68-bdb8f2c9309a/lib/python3.10/site-packages/openai/init.py:6
3 from future import annotations
5 import os as _os
----> 6 from typing_extensions import override
8 from . import types
9 from ._types import NoneType, Transport, ProxiesTypes
ImportError: cannot import name 'override' from 'typing_extensions' (/databricks/python/lib/python3.10/site-packages/typing_extensions.py)
To Reproduce
import openai
Code snippets
No response
OS
windows
Python version
python v3.10.12
Library version
openai v1.2.0
The text was updated successfully, but these errors were encountered: