I tried to install Google Cloud SDK on macOS, but it shows the following error.
Can anyone help please?
"Welcome to the Google Cloud SDK!
Traceback (most recent call last):
File "/Users/kaab/google-cloud-sdk/bin/bootstrapping/install.py", line 12, in <module>
import bootstrapping
File "/Users/kaab/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 46, in <module>
from googlecloudsdk.core.updater import update_manager
File "/Users/kaab/google-cloud-sdk/lib/googlecloudsdk/core/updater/update_manager.py", line 39, in <module>
from googlecloudsdk.core.console import progress_tracker
File "/Users/kaab/google-cloud-sdk/lib/googlecloudsdk/core/console/progress_tracker.py", line 651, in <module>
class _BaseStagedProgressTracker(collections.Mapping):
AttributeError: module 'collections' has no attribute 'Mapping'"
Are you running Python 3.10 or newer? Switch to an older Python version, or if you can edit the code, change the import statement to from collections.abc import Mapping.
When I import from collections import Mapping in Python 3.9, I get the message:
<stdin>:1: DeprecationWarning: Using or importing the ABCs
from 'collections' instead of from 'collections.abc' is deprecated
since Python 3.3, and in 3.10 it will stop working
(ABC stands for abstract base class.)
This means that ever since Python 3.3, the correct way to import this is from collections.abc import Mapping, and the old way finally stopped working in Python 3.10.
I'd call it a bug in Google Cloud SDK, but their documentation (at the time of the question) actually suggests to use Python 3.5 to 3.8, so I suspect they have not tested it on 3.10.
Edit: apparently Cloud SDK now (January 2024) says it supports up to 3.12. Presumably they have fixed the import. This answer might still be relevant to people who face this deprecation issue in other libraries.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With