☑️1 Step Fix: ModuleNotFoundError: No module named ‘awscli’

Quick Fix for: ModuleNotFoundError: No module named 'awscli' error. Run python3 -m pip install awscli in your terminal / PowerShell. That should reinstall AWS CLI and resolved the issue. If that doesn’t work scroll down for more details. If this helped you, I would appreciate you leaving a rating and a comment at the bottom.

ModuleNotFoundError: No module named ‘awscli’ error

Here is the full text of the error I got:

Traceback (most recent call last):
  File "/home/chart/.local/bin/aws", line 19, in <module>
    import awscli.clidriver
ModuleNotFoundError: No module named 'awscli'

This occurred when I was trying to run any AWS CLI command. It had previously been working, so at some point an update must have broken it.

The Fix for ModuleNotFoundError: No module named ‘awscli’

Simply run the command in your CLI. This command should work on Bash or ZSH for Linux/Mac and also in PowerShell for Windows.

python3 -m pip install awscli

Did that not work?

Try these commands:

python3 -m pip uninstall awscli
python3 -m pip install awscli

More fixes

  • Check python’s list of available modules for awscli
    • Open the python REPL by running `python3 and then run the following command `help(‘modules’)`
    • Check the listed modules for awscli
    • If the module does not exist, but the install commands are passing, then figure out where pip install is putting the module and make sure that path is also getting picked up
  • If those don’t work check the official docs for some more advice on installing the AWS CLI.

What Causes The ModuleNotFoundError: No module named ‘awscli’ Error?

According to the official Python docs in 5. The Import System “When a module is first imported, Python searches for the module and if found, it creates a module object 1, initializing it. If the named module cannot be found, a ModuleNotFoundError is raised.”

Therefor, when the ModuleNotFoundError is raised for awscli, we know the issue is that some python script has tried to import the awscli module but it is missing. We know python is working and the $PATH contains python, since python was able to execute, assuming you are running the `aws` command, so the issue must be that where ever python is looking for the module it does not exist.

See My Other AWS Posts


Are you looking to improve your AWS skills and connect with other cloud professionals?

Join the Arcadian Cloud discord group! Our community of AWS experts is dedicated to helping each other study for certifications, troubleshoot technical issues, enhance resumes, and secure better cloud jobs. Don’t miss out on this valuable opportunity to learn and grow with like-minded individuals. Click the link below to join now and start benefiting from the wealth of knowledge and support within our community.


Best aws cert courses ad

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.