“gcloud storage cp t.txt gs://my.bucket.name/” gives error: ModuleNotFoundError: No module named ‘google.auth’

I’m trying to upload a file to a bucket using:

gcloud storage cp t.txt gs://my.bucket.name/

But there’s an error:

Copying file://t.txt to gs://adhoc.textra.me/t.txt
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/homebrew/Cellar/[email protected]/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/spawn.py", line 122, in spawn_main
    exitcode = _main(fd, parent_sentinel)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/spawn.py", line 132, in _main
    self = reduction.pickle.load(from_parent)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/command_lib/storage/tasks/task_graph_executor.py", line 37, in <module>
    from googlecloudsdk.command_lib.storage import encryption_util
  File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/command_lib/storage/encryption_util.py", line 28, in <module>
    from googlecloudsdk.command_lib.storage import hash_util
  File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/command_lib/storage/hash_util.py", line 25, in <module>
    from googlecloudsdk.command_lib.storage import fast_crc32c_util
  File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/command_lib/storage/fast_crc32c_util.py", line 32, in <module>
    from googlecloudsdk.command_lib import info_holder
  File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/command_lib/info_holder.py", line 45, in <module>
    from googlecloudsdk.core.credentials import store as c_store
  File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/core/credentials/store.py", line 34, in <module>
    from googlecloudsdk.api_lib.auth import external_account as auth_external_account
  File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/api_lib/auth/external_account.py", line 24, in <module>
    from googlecloudsdk.core.credentials import creds as c_creds
  File "/opt/homebrew/share/google-cloud-sdk/lib/googlecloudsdk/core/credentials/creds.py", line 33, in <module>
    from google.auth import compute_engine as google_auth_compute_engine
ModuleNotFoundError: No module named 'google.auth'
  Completed files 0/1 | 0B/16.5kiB

It hangs at that point and doesn’t upload.

This is on Macos with the google-cloud-sdk installed via Brew:

$ brew info google-cloud-sdk
==> google-cloud-sdk: 479.0.0 (auto_updates)
https://cloud.google.com/sdk/
Installed
/opt/homebrew/Caskroom/google-cloud-sdk/479.0.0 (132B)
From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/g/google-cloud-sdk.rb
==> Name
Google Cloud SDK
==> Description
Set of tools to manage resources and applications hosted on Google Cloud
==> Artifacts
google-cloud-sdk/install.sh (Installer)
google-cloud-sdk/bin/gsutil (Binary)
google-cloud-sdk/completion.bash.inc -> /opt/homebrew/etc/bash_completion.d/google-cloud-sdk (Binary)
google-cloud-sdk/bin/bq (Binary)
google-cloud-sdk/bin/docker-credential-gcloud (Binary)
google-cloud-sdk/completion.zsh.inc -> /opt/homebrew/share/zsh/site-functions/_google_cloud_sdk (Binary)
google-cloud-sdk/bin/gcloud (Binary)
google-cloud-sdk/bin/git-credential-gcloud.sh -> git-credential-gcloud (Binary)
==> Caveats
To add gcloud components to your PATH, add this to your profile:

  for bash users
    source "$(brew --prefix)/share/google-cloud-sdk/path.bash.inc"

  for zsh users
    source "$(brew --prefix)/share/google-cloud-sdk/path.zsh.inc"
    source "$(brew --prefix)/share/google-cloud-sdk/completion.zsh.inc"

  for fish users
    source "$(brew --prefix)/share/google-cloud-sdk/path.fish.inc"

==> Analytics
install: 11,361 (30 days), 33,066 (90 days), 118,204 (365 days)

The SDK has been updated to the latest version:

$
~/delicious/textra (git)  $ gcloud -v
Google Cloud SDK 487.0.0
beta 2024.08.06
bq 2.1.7
core 2024.08.06
gcloud-crc32c 1.0.0
gsutil 5.30

Uploading using gsutil works fine, but I want to use gcloud compute cp ... so I can specify a configuration, e.g. gcloud --configuration=dev compute cp ....

What can I try to solve this?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật