公式からダウンロードしてきた tarball からインストールすると以下のエラーが出ます。
/google-cloud-sdk ❯❯❯ ./install.sh Welcome to the Google Cloud SDK! Traceback (most recent call last): File "/Users/nazo/google-cloud-sdk/bin/bootstrapping/install.py", line 12, in <module> import bootstrapping File "/Users/nazo/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 32, in <module> import setup # pylint:disable=g-import-not-at-top File "/Users/nazo/google-cloud-sdk/bin/bootstrapping/setup.py", line 57, in <module> from googlecloudsdk.core.util import platforms File "/Users/nazo/google-cloud-sdk/lib/googlecloudsdk/__init__.py", line 23, in <module> from googlecloudsdk.core.util import importing File "/Users/nazo/google-cloud-sdk/lib/googlecloudsdk/core/util/importing.py", line 23, in <module> import imp File "/opt/homebrew/Cellar/python@3.9/3.9.1_6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/imp.py", line 23, in <module> from importlib import util File "/opt/homebrew/Cellar/python@3.9/3.9.1_6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/util.py", line 2, in <module> from . import abc File "/opt/homebrew/Cellar/python@3.9/3.9.1_6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/abc.py", line 17, in <module> from typing import Protocol, runtime_checkable File "/opt/homebrew/Cellar/python@3.9/3.9.1_6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/typing.py", line 26, in <module> import re as stdlib_re # Avoid confusion with the re we export. File "/opt/homebrew/Cellar/python@3.9/3.9.1_6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/re.py", line 124, in <module> import enum File "/Users/nazo/google-cloud-sdk/lib/third_party/enum/__init__.py", line 26, in <module> spec = importlib.util.find_spec('enum') AttributeError: module 'importlib' has no attribute 'util'
curl でインストールするともう少し進みますが以下のエラーが出ます。
~ ❯❯❯ curl https://sdk.cloud.google.com | bash (略) Welcome to the Google Cloud SDK! To help improve the quality of this product, we collect anonymized usage data and anonymized stacktraces when crashes are encountered; additional information is available at <https://cloud.google.com/sdk/usage-statistics>. This data is handled in accordance with our privacy policy <https://cloud.google.com/terms/cloud-privacy-notice>. You may choose to opt in this collection now (by choosing 'Y' at the below prompt), or at any time in the future by running the following command: gcloud config set disable_usage_reporting false Do you want to help improve the Google Cloud SDK (y/N)? This will install all the core command line tools necessary for working with the Google Cloud Platform. Beginning update. This process may take several minutes. ERROR: (gcloud.components.update) The following components are unknown [anthoscli, kuberun].
これは anthoscli
kuberun
のコンポーネントがインストールできない( gcloud components install anthoscli kuberun
と同等)のが原因です。
回避するには、curl で上記エラーが出た時点で ~/google-cloud-sdk
にファイル一式があるはずなので、移動して以下のように実行します。
~/google-cloud-sdk ❯❯❯ ./install.sh --override-components core gcloud-deps bq gcloud gsutil Welcome to the Google Cloud SDK! (略) Your current Cloud SDK version is: 323.0.0 Installing components from version: 323.0.0 ┌────────────────────────────────────────────────────────────────────────────┐ │ These components will be installed. │ ├─────────────────────────────────────────────────────┬────────────┬─────────┤ │ Name │ Version │ Size │ ├─────────────────────────────────────────────────────┼────────────┼─────────┤ │ BigQuery Command Line Tool │ 2.0.64 │ < 1 MiB │ │ BigQuery Command Line Tool (Platform Specific) │ 2.0.58 │ < 1 MiB │ │ Cloud SDK Core Libraries (Platform Specific) │ 2020.07.10 │ < 1 MiB │ │ Cloud Storage Command Line Tool │ 4.57 │ 3.5 MiB │ │ Cloud Storage Command Line Tool (Platform Specific) │ 4.51 │ < 1 MiB │ └─────────────────────────────────────────────────────┴────────────┴─────────┘ For the latest full release notes, please visit: https://cloud.google.com/sdk/release_notes (略) For more information on how to get started, please visit: https://cloud.google.com/sdk/docs/quickstarts
インストールに成功しました。
override-components
で指定した引数は、以下で確認したものからエラーが出るものを抜いたものになります。
~/google-cloud-sdk ❯❯❯ cat bin/bootstrapping/.default_components ["core", "gcloud-deps", "bq", "gcloud", "gsutil", "anthoscli", "kuberun"]%
anthoscli も kuberun も、おそらく無くて困る人は多くないのではないかと思いますので、抜いてインストールしてしまっていいと思います。