OpenAI error in when it comes to install

Summary

Hi Streamlit community !
I’m trying to use OpenAI API in my streamlit app.
To do so, I added in my requierements a line “openai” and in my code “import openai”
However I get an error in “Manage app terminal” (cf. screenshot bellow)
Do you know what’s wrong here and how to fix ? Thks

1 Like

Hi @Pierre_BRUAT,

Thanks for posting and welcome to the Streamlit Community!

Please check out our new guidelines for posting in the forum and update your post to include a properly formatted code snippet.

In the meantime, is the app working locally?

If yes, the issue might be solved by making your repository private. Someone had an almost similar issue here.

Happy Streamlit-ing :balloon:

Hello !
Thanks for your feedback. I will check new guidelines.
Yes it is working locally.
The repo is private so I do not understand why it is not working within Streamlit cloud.

The traceback in the screenshot makes clear what the error is. For openai==0.0.2:

This package is a placeholder on the public PyPi instance, and is not the correct version to install

The version of openai getting installed is just an obsolete placeholder and not a real package. You need to pin a more recent version in your requirements, such as openai==0.25.0

Happy Streamlit-ing! :balloon:
Snehan

Going forward, please follow our guidelines on posting an effective question and include relevant information that will help the community debug your issue. That includes links to your GitHub repo, app, and the contents of your requirements file.