-
Notifications
You must be signed in to change notification settings - Fork 414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. #114
Comments
@yihong0618, could you provide a repro for this issue? As @reconsumeralization points out, we will need to see that you have the relevant env vars set to rule out a bad environment. I can see in #115 you have suggested downgrading |
sorry its not download its update google-auth version. Will I need to update the google-auth version to the latest in my PR? |
Ah interesting - can you explain what the issue is then? Ideally with a repro. As @reconsumeralization pointed out, the error in the original report can be expected in some cases, so it would help us to understand what is actually wrong.
This is what we want to avoid, but using a I've tried to repro your issue but I can't:
|
@markmcd and for me, change |
I still can't reproduce, tried with python 3.9 and 3.11 (as you are using):
Are you using a clean environment? e.g. an empty venv? |
sorry will using a venv test and let you know later. |
@markmcd
pip install -r t.txt import google.generativeai as genai
from os import environ
genai.configure(api_key=environ.get("GOOGLE_API_KEY"))
pro = genai.GenerativeModel('models/gemini-pro')
print(pro.generate_content('the opposite of hot is').text) python test.py |
Ah - I believe it's working for me because I still have credentials available (i.e. I've run I think I've found the issue - this commit added API key auth support to For context, the auth lib expects some credentials to be present, but versions older than 2.15.0 don't recognise API keys as credentials, so you got that error (and I did not, because I had other supported credentials present). Edit: I've confirmed by testing with 2.15.0 (works), and with 2.14.1 (does not work). |
Ah thanks for the explain and the commit link its very interesting and learned something from it. |
@markmcd just found you continue commit, thanks a lot. |
Thanks for the report and your patience! |
Sorry for not getting back to you sooner. I couldn't repro it, I'm sorry. |
Description of the bug:
when use low google-auth package will raise this problem

Actual vs expected behavior:
No response
Any other information you'd like to share?
No response
The text was updated successfully, but these errors were encountered: