-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
TimeoutError in File_API.ipynb #54
Comments
Hi @uezhenxiang2023, apologies you're running into issues with the colab locally. Maybe you can try running the python script directly: Let me know if that helps and it should help us understand why you're running into this |
Hi @TYMichaelChen , |
Is this still happening? If so could you provide some more detail around your environment, etc. |
Marking this issue as stale since it has been open for 14 days with no activity. This issue will be closed if no further activity occurs. |
File "/home/useR/.cache/pypoetry/virtualenvs/secret-BeE8oWav-py3.12/lib/python3.12/site-packages/google/generativeai/files.py", line 71, in upload_file
response = client.create_file(
^^^^^^^^^^^^^^^^^^^
File "/home/useR/.cache/pypoetry/virtualenvs/secret-BeE8oWav-py3.12/lib/python3.12/site-packages/google/generativeai/client.py", line 83, in create_file
self._setup_discovery_api()
File "/home/useR/.cache/pypoetry/virtualenvs/secret-BeE8oWav-py3.12/lib/python3.12/site-packages/google/generativeai/client.py", line 65, in _setup_discovery_api
response, content = request.execute()
^^^^^^^^^^^^^^^^^
File "/home/useR/.cache/pypoetry/virtualenvs/secret-BeE8oWav-py3.12/lib/python3.12/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper
return wrapped(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/useR/.cache/pypoetry/virtualenvs/secret-BeE8oWav-py3.12/lib/python3.12/site-packages/googleapiclient/http.py", line 923, in execute
resp, content = _retry_request(
^^^^^^^^^^^^^^^
File "/home/useR/.cache/pypoetry/virtualenvs/secret-BeE8oWav-py3.12/lib/python3.12/site-packages/googleapiclient/http.py", line 222, in _retry_request
raise exception
File "/home/useR/.cache/pypoetry/virtualenvs/secret-BeE8oWav-py3.12/lib/python3.12/site-packages/googleapiclient/http.py", line 191, in _retry_request
resp, content = http.request(uri, method, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/useR/.cache/pypoetry/virtualenvs/secret-BeE8oWav-py3.12/lib/python3.12/site-packages/httplib2/__init__.py", line 1726, in request
(response, content) = self._request(
^^^^^^^^^^^^^^
File "/home/useR/.cache/pypoetry/virtualenvs/secret-BeE8oWav-py3.12/lib/python3.12/site-packages/httplib2/__init__.py", line 1446, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/useR/.cache/pypoetry/virtualenvs/secret-BeE8oWav-py3.12/lib/python3.12/site-packages/httplib2/__init__.py", line 1368, in _conn_request
conn.connect()
File "/home/useR/.cache/pypoetry/virtualenvs/secret-BeE8oWav-py3.12/lib/python3.12/site-packages/httplib2/__init__.py", line 1158, in connect
sock.connect((self.host, self.port))
TimeoutError: [Errno 110] Connection timed out
|
In this case, seeing the code might help. Are you running in Colab like the original issue was? Your paths indicate a possibly different environment. Is it Linux? Since this is a network error can you describe the network environment you're connecting from? e.g. "$ISP in $Country" or "$cloud_provider", as well as any proxy or VPN you might have running. And can you show whether you're able to connect to that host/port? e.g. using telnet or netcat: $ nc -zw60 generativelanguage.googleapis.com 443
Connection to generativelanguage.googleapis.com (142.250.70.234) 443 port [tcp/https] succeeded! |
@markmcd Thank you for reply.I ran the code locally with vpn and the enviroment information is in the following snapshot. |
And there is no response after runing |
Found out. My company go outside by proxy. So either vpn, proxy doesn't works. |
Marking this issue as stale since it has been open for 14 days with no activity. This issue will be closed if no further activity occurs. |
It looks like your request is coming from China. Unfortunately 中国 isn't a supported region but it doesn't look like Google is doing the blocking - you could be hitting the GFW.
I can't help you circumvent the available region list, but if your requests are connecting from a supported region but need to set up a corporate proxy, that should be supported. I noted some approaches in google-gemini/generative-ai-python#188 (comment). |
Marking this issue as stale since it has been open for 14 days with no activity. This issue will be closed if no further activity occurs. |
This issue was closed because it has been inactive for 27 days. Please post a new issue if you need further assistance. Thanks! |
Hi,
I got a TimeoutError while executing the File_API.ipynb locally on my Macbook Pro.
I can list the models with genai.list_model() request:
But the error poped after running the following line:
Here is the Traceback
And I double checked the image is downloaded successfully above the upload_file request cell:
This problem has been tormenting me for two days,I tried different ways to solve it but make no sense.
Look forward to get some suggestion here.
Sincere thanks!
The text was updated successfully, but these errors were encountered: