I have configured my OpenAI API key for all projects via terminal and I can verify the configuration by typing echo $OPENAI_API_KEY in the terminal and it shows my API key correctly or I use printenv and it shows my API key correctly.
My API KEY appear here
open ./.zshrc
So far so good.
Now, I use on a cell
%env
My API KEY doesn’t appear, why? How can I get my OPENAI_API_KEY environment variable in JupiterLAb?
I did this to check it
import sys
print(sys.executable)
and return path, what place python is run
…/Library/jupyterlab-desktop/jlab_server/bin/python
In this case, when I run …/Library/jupyterlab-desktop/jlab_server/bin/python (3.8.18) by Terminal, I did this
'>>> import os
'>>> api_key = os.getenv(‘OPENAI_API_KEY’)
'>>> print(api_key)
sk-… (The API_KEY is showed)
On my Notebook Jupyter I did this:
from platform import python_version
print(python_version()) and returned
3.8.18
Somehow from JupyterLab it doesn’t allow me to access to environment variable OPENAI_API_KEY
My version in langchain is 0.0.350
By the way, I have just installed Anaconda Navigator (I don’t know if can be useful)