In my case it worked with updating my open ai.
First I ran the command to check my openai version which was 0.23.1 or something (use command pip show openai in command prompt or !pip show openai in jupyter lab.
Then I ran !pip install --upgrade openai in jupyter lab (remove ! when running in command prompt).
after that I ran the command and worked for me.
if you are using chat gpt more than 3 months then the attribute error is arising because of exceed limit for usage, so open new open ai account which can help to ressolve the problem
I faced the same problem while using a venv environment. Then realised by openai --version that the openai version was 0.19.0. So, did pip install --upgrade openai and then the openai library version was upgraded to 0.27.8. Updated the requirements.txt file with openai=0.27.8. Solved !
I changed my Python interpreter to 3.9 and open ai version to 0.27.8, and now it’s working completely fine (Initially, my interpreter was set to 3.10, giving me the same stated error).
Hey i created a file named openai.py just to save some code and was getting the same error. your comment helped alot. Thanks for helping people like us.
I tried everything shown here but still I’ m getting the same result “partially initialized module ‘openai’ has no attribute ‘Completion’ (most likely due to a circular import)” what to do can please someone help me
I was using the quickstart example and I had to go into the terminal and run pip install --upgrade openai
turns out I was on 0.19 which is weird because I remember I had to re-install openai because there was an error. I assumed it would’ve just installed the latest version but it didn’t. Then I ran the upgrade command and mine works. Currently as of openai==0.27.8
Thanks a ton! This was my exact problem. Seems that it’s a openai file which got overridden. Could never think of it! It was driving me crazy. Also, welcome all the similar minds who named their file to openai.py
First uninstall openai package using pip uninstall openai and then reinstall using pip install openai. Also make sure to remove/update the openai package from the virtual env, if you are using one. I has openai in my virtual env and removing and upgrading it worked!