cmpletion = openai.ChatCompletion.create ( model=“gpt-3.5-turbo”, messages=[{“role”: “user”, “content”: “Tell the world about the ChatGPT API in the style of a pirate.”}])
AttributeError: module ‘openai’ has no attribute ‘ChatCompletion’
One problem that often may be experienced is a system install you do not have rights to modify as your user name, and so when pip was run, a version was installed only in your computer’s user account. You might have a different local version, diffent conda version, different version per python directory, per venv, etc.
You’ll need to find correct directories.
One option is to pip uninstall openai under your user account until there is nothing left to uninstall, log in as administrator and do the same. Check your python in the system path and check the python environment variable and make them correct, then open another shell and repeat the uninstalling.
Then if python is installed “for all users” in a system install, run the command prompt as administrator, and do a final “install --upgrade” from there. (same applies to unix/linux/bsd and shell and usernames/sudo)