I recently ran into a strange issue where I was struggling to get the GCloud SDK to work properly on Mac 14.2.1.
I used brew to install the package brew install google-cloud-sdk
and added it to my zshrc file.
After I logged in with gcloud auth login
I wanted to copy some files out of a GCP bucket to my local machine with the storage cp command:
gcloud storage cp gs://bucketname/filename .
The command looked fine and detected the right number of files to copy before crashing out with this rather odd looking error message:
gcloud crashed (AttributeError): 'Lock' object has no attribute 'is_fork_ctx'
a quick search surfaced this ticket in google's issue tracker showing exactly the same problem. It turns out that gcloud is a Python package and it doesn't play nicely with the version of Python that this version of MacOS has installed.
My workaround was to use Anaconda (which I have installed anyway as a data science bod) to create a new Python environment at a version that gcloud likes. Then to install gcloud from conda:
conda create -n cloudtest python=3.10 conda activate cloudtest conda install google-cloud-sdk
Once I had this set up I found that the command suddenly burst into life.
A Simpler Alternative?
If you don't want to use Anaconda, Google's installer offers to install a compatible version of Python for you. In fact, using brew made life harder for me - I could have just followed the Google experience.
Replies & Web Activities
If you would like to comment or reply then toot me or bluesky me about this url, or send me a webmention