close

[Solved] AttributeError: module ‘importlib’ has no attribute ‘util’

Hello Guys, How are you all? Hope You all Are Fine. Today I just updated to Fedora 33 But Now I am not able to run gcloud command. I am facing following error AttributeError: module ‘importlib’ has no attribute ‘util’ in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How AttributeError: module ‘importlib’ has no attribute ‘util’ Error Occurs ?

I just updated to Fedora 33 But Now I am not able to run gcloud command. I am facing following error.

  Traceback (most recent call last):
    File "/usr/lib64/python3.9/site.py", line 169, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
    File "<frozen importlib._bootstrap>", line 562, in module_from_spec
  AttributeError: 'NoneType' object has no attribute 'loader'

Remainder of file ignored
Traceback (most recent call last):
  File "/usr/lib64/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'

How To Solve AttributeError: module ‘importlib’ has no attribute ‘util’ Error ?

  1. How To Solve AttributeError: module ‘importlib’ has no attribute ‘util’ Error ?

    To Solve AttributeError: module ‘importlib’ has no attribute ‘util’ Error To fix this error just run gcloud components update.

  2. AttributeError: module ‘importlib’ has no attribute ‘util’

    To Solve AttributeError: module ‘importlib’ has no attribute ‘util’ Error To fix this error just run gcloud components update

Solution 1: Just Update gcloud

To fix this error just run

gcloud components update

Solution 2: For macos

brew install python@3.8
export CLOUDSDK_PYTHON=python3.8
ln -s /usr/local/Cellar/python@3.8/*/bin/python3.8 /usr/local/bin/python3.8

gcloud components update

# the issue is now resolved and you can return to python 3.9
unset CLOUDSDK_PYTHON

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Leave a Comment