openai / openai-quickstart-python

Python example app from the OpenAI API quickstart tutorial
https://platform.openai.com/docs/quickstart?context=python
MIT License
1.66k stars 1.31k forks source link

ModuleNotFoundError: No module named 'openai' #47

Closed natea closed 4 months ago

natea commented 1 year ago

When I run flask run the following error occurs:

Error: While importing 'app', an ImportError was raised:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/flask/cli.py", line 218, in locate_app
    __import__(module_name)
  File "/Users/nateaune/Documents/code/openai-quickstart-python/app.py", line 3, in <module>
    import openai
ModuleNotFoundError: No module named 'openai'

there were no errors when openai was built and installed:

Building wheels for collected packages: openai
  Building wheel for openai (pyproject.toml) ... done
  Created wheel for openai: filename=openai-0.19.0-py3-none-any.whl size=53511 sha256=d5b4ad9f8b285a32943fa9bee65e0f3f3c538a255b47f4cfb1457c0ef96a8bab
  Stored in directory: /Users/nateaune/Library/Caches/pip/wheels/ca/5c/0f/2e2eeef583f5b213b178cfbf881921046b259f79fb5527aa6e
Successfully built openai
1stpersoncj commented 1 year ago

Having the same issue.

tanaynayak commented 1 year ago

Use python -m flask run and see if it solves the issue

Mrkezii commented 11 months ago

did this solve your issue @1stpersoncj ?

Tried this and still did not work for me

logankilpatrick commented 4 months ago

Hey, make sure you are on the latest version of: https://github.com/openai/openai-python with a clean python env.