#ModuleNotFoundError: No module named 'openai.embeddings_utils'; 'openai' is not a package

3 messages · Page 1 of 1 (latest)

twilit mortar
#

I've been working with the embeddings api for a week or so without any issue. Now suddenly my python scripts are failing to run after a VS code update. I think my python environments got messed up somehow, but I only every use one (just with conda activate) and I still only have one conda environment.

I try importing with

from openai.embeddings_utils import cosine_similarity

But get

ModuleNotFoundError: No module named 'openai.embeddings_utils'; 'openai' is not a package

I have tried rerunning python -m pip install openai and python -m pip install openai[embeddings], but everything is already satisfied, as I'd expect. I then run my code with python script.py. This is all in the same terminal session. Nothing online I have found has helped.

twilit mortar
twilit mortar
#

I solved my issue. I had a empty openai.py file in the same directory which was overwritting the normal package.