Flo007
June 20, 2024, 3:23pm
1
ImportError Traceback (most recent call last)
Cell In[16], line 2
1 import os
----> 2 from utils import get_openai_api_key
4 openai_api_key = get_openai_api_key()
5 os.environ[“OPENAI_MODEL_NAME”] = ‘gpt-3.5-turbo’
ImportError: cannot import name ‘get_openai_api_key’ from ‘utils’ (C:\Users\flore\utils.py)
Are you running this in your own environment, if so you need an OPENAI key. If not try to reset the kernel, and hopefully you haven’t deleted any of the util files by mistake!
Thanks. I am running on my own environment. I have set an open AI key. Still getting this error.
Hi @Naama_Ben-Oliel_Rone
Follow the comment mentioned by Mubsi in the below link
Hi @caebby ,
Firstly, to access your workspace, which has all the files needed in order to run the notebook can be done so by clicking on Menu --> File --> Open... when inside of the Jupyter notebook on the platform. This is where you’ll find the utils.py file, which you can then download.
Secondly, the way it has been set up is that the utils.py file will read the open AI API key from .env file, the visibility of which is not available to the learners, and cannot be used outside of the platfo…
Regards
DP
Thanks! I found the utils.py where you guided me.
The thing is that I try to run things locally and not via the notebook. I use mac Visual Studio Code. How can I make this utils.py available?
Should I update the $PATH somehow? … What do u suggest me doing?
did you download the utils py files and all the necessary files from the instructions mentioned by Mubsi? in your local computer?
i didn’t see it. Where can I please find the guidelines? This would be fantastic.
You need to follow the same guidelines mentioned in the above comment by Mubsi.
If you are unable to understand his comments then first download all the files use File==Open options and then download all the files.
Check this another comment which explains you the steps with images for your better understanding.
First, you have to install the dotenv package from pypi:
python-dotenv · PyPI
Second, you have to download the utils.py package from the course platform by:
Clicking on the jupyter logo
[image]
Clicking on the utils.py package > file > download
[image]
[image]
After download this files, you have to setting your google API key on the .env file in your project root folder.
You can do that by following this tutorial:
Keep in mind that you have to keep on the files in one single structur…
Let me know if you are still not understanding.
Regards
DP
1 Like