I’m getting this error suddenly when using the gemini-1.5-flash model.
It says
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
E0000 00:00:1731955515.629532 17124 init.cc:229] grpc_wait_for_shutdown_with_timeout() timed out.
there is no response being printed -
import google.generativeai as genai
genai.configure(api_key='')
model = genai.GenerativeModel("gemini-1.5-flash")
response = model.generate_content("Explain how AI works")
print(response.text)
Same issue.
With flash and exp-1121.
Interestingly, when I send the output (via print) to stdout I can read it and then I see the error but when I’m using Gemini’s response in a script it seems to not save the response due to the error.
(Didn’t do a full debug, but that’s what it seems like so far)
+1 same issue here
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
E0000 00:00:1732664313.522866 17588 init.cc:229] grpc_wait_for_shutdown_with_timeout() timed out.
It seems like several users, including myself, have encountered the “grpc_wait_for_shutdown_with_timeout() timed out” error. I appreciate the suggestion to try installing grpcio==1.67.1. I’m going to give that a shot and see if it resolves the issue for me as well.
Thanks @nobuo_kawasaki! Specifying grpcio==1.67.1 fixed the gRPC timeout warning for me too. For anyone else encountering this issue in their project, here’s how I solved it using uv package manager with Python 3.12:
# pyproject.toml
dependencies = [
"grpcio==1.67.1" # This specific version resolves the timeout warning
]
This solves the “grpc_wait_for_shutdown_with_timeout() timed out” error without needing to downgrade Python or modify other dependencies. I’m using uv for virtual environment and package management - it works perfectly with this configuration.
This did not work for me. It got rid of the warning message, but the service itself still does not work. If anything this is worse because it is failing more silently than before.