在OS X上安装Google Cloud SDK:(gcloud.components.list)无法从服务器获取组件列表 [英] Google Cloud SDK install on OS X: (gcloud.components.list) Failed to fetch component listing from server
问题描述
我正在尝试安装Google Cloud SDK( https://cloud.google.com/sdk/docs/quickstart-mac-os-x ),并显示以下错误:
ERROR: (gcloud.components.list) Failed to fetch component listing from server. Check your network settings and try again.
I'm trying to install the Google Cloud SDK (https://cloud.google.com/sdk/docs/quickstart-mac-os-x) and get this error:
ERROR: (gcloud.components.list) Failed to fetch component listing from server. Check your network settings and try again.
已经尝试更新OpenSSL和相应的Python(也尝试过Python 2.7.8):
Already tried updating OpenSSL and corresponding Python (also tried Python 2.7.8):
openssl version
OpenSSL 1.0.2k 26 Jan 2017
python -V
Python 2.7.13
Python也在使用此OpenSSL版本:
Python is also using this OpenSSL version:
>>> import ssl
>>> ssl.OPENSSL_VERSION
'OpenSSL 1.0.2k 26 Jan 2017'
我正在运行mac OS 10.12.4
我也尝试过brew cask install google-cloud-sdk
,它实际上只是下载普通版本并执行install.sh脚本.结果相同.
I've also tried brew cask install google-cloud-sdk
which effectively just downloads the normal version und executes the install.sh script. Same result.
进一步的调试显示,它无法加载https://dl.google.com/dl/cloudsdk/channels/rapid/components-2.json
并引发以下错误:URLError: <urlopen error timed out>
.
通过Python直接加载此文件有效:
Further debugging showed, it's unable to load https://dl.google.com/dl/cloudsdk/channels/rapid/components-2.json
and throws this error: URLError: <urlopen error timed out>
.
Loading this file via Python directly works:
urllib2.urlopen('https://dl.google.com/dl/cloudsdk/channels/rapid/components-2.json')
有什么想法吗?此外,任何有关如何进一步调试的提示,将不胜感激:)
Any ideas? Also any hints how to further debug this, would be appreciated :)
推荐答案
关闭ipv6支持后,该工具就像一个超级按钮一样工作.看来gcloud无法在ipv6上正常使用...
After turning off ipv6 support, the tool works like a charm. Looks like gcloud can not work gracefully with ipv6...
禁用ipv6:
networksetup -setv6off Wi-Fi
启用ipv6:
networksetup -setv6automatic Wi-Fi
注意:在调查此问题时,我还使用了非常长的超时时间(120秒)来使其正常工作.但是,对于大多数用例来说,这是不切实际的,因为它会为每个命令引入很长的延迟.
Note: While investigating this, I was also able to make it work by using a very long timeout — 120 seconds. This wouldn't be practical, though, for most use cases due to the long delays it would introduce for each command.
超时位于google-cloud-sdk/lib/googlecloudsdk/core/updater/installers.py
的第36行,称为TIMEOUT_IN_SEC
The timeout is located in google-cloud-sdk/lib/googlecloudsdk/core/updater/installers.py
at line 36 called TIMEOUT_IN_SEC
这篇关于在OS X上安装Google Cloud SDK:(gcloud.components.list)无法从服务器获取组件列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!