From openai import OpenAI in Python

I have tried for hours to run this short Python program and keep getting " from openai import OpenAI
ModuleNotFoundError: No module named ‘openai’"

my python version is 3.12.1 and openai is 1.7.2

I have read the threads here on this topic. Any suggestions?
Thanks

1 Like

Hi! Welcome to the forums!

Are you using jupyter? did you install it into the correct environment? sometimes you need to restart the kernel or the whole shell for it to work.

2 Likes

hmm… I use

import openai

thats all. I#m not sure is your statement right

Hi Diet,
Jupyter is enabled but I’m not using it.
Thx

Welcome to the forum!

Do you have another file called “openai.py” in the same folder?

1 Like

I am still getting " from openai import OpenAI
ModuleNotFoundError: No module named ‘openai’" when I run my Python app. Am I the only one getting this now? Why am I getting this?
Thanks!

Do you have a file named openai.py in your project, perchance?

https://community.openai.com/search?q=OpenAI%20ModuleNotFoundError%3A%20No%20module%20named%20%27openai%27