AttributeError: module ‘importlib’ has no attribute ‘util’ error occurs when you “upgraded from Fedora 32 to Fedora 33 (which comes with Python 3.9) and gcloud stopped working!”
How to fix it?
To fix the AttributeError: module ‘importlib’ has no attribute ‘util’ error, “update gcloud sdk to the latest version.”
To update to the latest version, use this command:
gcloud components update
If you are using Fedora 33, which includes Python 2.7, and wish to force the gcloud SDK to use Python 2.7 instead of the default Python version, you can set the CLOUDSDK_PYTHON environment variable:
export CLOUDSDK_PYTHON=python2
To make this change permanent and ensure it’s applied every time you open a new terminal session:
- Open your ~/.bash_profile file in a text editor (e.g., nano ~/.bash_profile).
- Add the export CLOUDSDK_PYTHON=python2 command to the end of the file.
- Save and close the file.
- To apply the changes immediately, source your ~/.bash_profile by running source ~/.bash_profile.
It will fix the error!
Related posts
AttributeError: module ‘google.protobuf.descriptor’ has no attribute ‘_internal_create_key’
ImportError: cannot import name ‘builder’ from ‘google.protobuf.internal’
ModuleNotFoundError: no module named ‘google’
AttributeError: ‘module’ object has no attribute ‘misc’

Krunal Lathiya is a seasoned Computer Science expert with over eight years in the tech industry. He boasts deep knowledge in Data Science and Machine Learning. Versed in Python, JavaScript, PHP, R, and Golang. Skilled in frameworks like Angular and React and platforms such as Node.js. His expertise spans both front-end and back-end development. His proficiency in the Python language stands as a testament to his versatility and commitment to the craft.