[英]Google Cloud SDK install on OS X: (gcloud.components.list) Failed to fetch component listing from server
I'm trying to install the Google Cloud SDK ( https://cloud.google.com/sdk/docs/quickstart-mac-os-x ) and get this error:我正在尝试安装 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.
Already tried updating OpenSSL and corresponding Python (also tried Python 2.7.8):已经尝试更新 OpenSSL 和相应的 Python(也尝试过 Python 2.7.8):
openssl version
OpenSSL 1.0.2k 26 Jan 2017
python -V
Python 2.7.13
Python is also using this OpenSSL version: Python 也在使用这个 OpenSSL 版本:
>>> import ssl
>>> ssl.OPENSSL_VERSION
'OpenSSL 1.0.2k 26 Jan 2017'
I'm running mac OS 10.12.4
我正在运行mac OS 10.12.4
I've also tried brew cask install google-cloud-sdk
which effectively just downloads the normal version und executes the install.sh script.我也试过brew cask install google-cloud-sdk
,它实际上只是下载普通版本并执行 install.sh 脚本。 Same result.结果一样。
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>
.进一步的调试显示,它无法加载https://dl.google.com/dl/cloudsdk/channels/rapid/components-2.json
并抛出此错误: URLError: <urlopen error timed out>
。 Loading this file via Python directly works:通过 Python 直接加载此文件有效:
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 :)还有任何关于如何进一步调试的提示,将不胜感激:)
After turning off ipv6 support, the tool works like a charm.关闭 ipv6 支持后,该工具就像一个魅力。 Looks like gcloud can not work gracefully with ipv6...看起来 gcloud 无法在 ipv6 下正常工作...
Disable ipv6:禁用ipv6:
networksetup -setv6off Wi-Fi
Enable ipv6:启用ipv6:
networksetup -setv6automatic Wi-Fi
Note: While investigating this, I was also able to make it work by using a very long timeout — 120 seconds.注意:在对此进行调查时,我还能够通过使用很长的超时时间(120 秒)来使其工作。 This wouldn't be practical, though, for most use cases due to the long delays it would introduce for each command.但是,这对于大多数用例来说是不切实际的,因为它会为每个命令引入长时间的延迟。
The timeout is located in google-cloud-sdk/lib/googlecloudsdk/core/updater/installers.py
at line 36 called TIMEOUT_IN_SEC
超时位于google-cloud-sdk/lib/googlecloudsdk/core/updater/installers.py
第 36 行,名为TIMEOUT_IN_SEC
禁用 IPV6:
sysctl net.ipv6.conf.all.disable_ipv6=1
Disabling ipv6 didn't work for me.禁用 ipv6 对我不起作用。 I tried a bunch of things before getting it to work.在让它工作之前,我尝试了很多东西。 I upgraded to mojave OSX before getting the issues.在遇到问题之前,我升级到 mojave OSX。
I updated mac headers as mentioned here :我更新了此处提到的 mac 标头:
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
Rebooted then reinstalled python2: brew reinstall python2
重新启动然后重新安装python2: brew reinstall python2
At this point the issue still persisted, decided to reinstall gcloud and came across this : I was using zsh so I added the followin .zshrc
:此时问题仍然存在,决定重新安装 gcloud 并遇到了这个:我正在使用 zsh 所以我添加了以下.zshrc
:
source <PATH to gcloud sdk>/google-cloud-sdk/path.zsh.inc
source <PATH to gcloud sdk>/google-cloud-sdk/completion.zsh.inc
For bash:对于 bash:
source <PATH to gcloud sdk>/google-cloud-sdk/path.bash.inc
source <PATH to gcloud sdk>/google-cloud-sdk/completion.bash.inc`
Then a gcloud init
got me resetting some proxy configuration that was probably the main issue from the start.然后gcloud init
让我重置一些代理配置,这可能是一开始的主要问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.