How Do You Troubleshoot the AWS CLI Error “Traceback … import pkg_resources”?

Problem scenario
You run an "aws" command but you receive an error message such as this:

Traceback (most recent call last):
  File "/usr/bin/aws", line 4, in <module>
    import pkg_resources
  File "/usr/lib/python2.7/site-packages/", line 3007, in <module>

What should you do?

1.  Install pip.  If you need assistance, see this posting (especially the "Problem scenario" paragraph with hyperlinks based on distribution families of Linux).

2.  Do run this command:
sudo pip install colorama rsa s3transfer ruamel.yaml botocore

3.  Try the aws command again.  If it fails, install a different, older version of the awscli.  You can go to /bin/ and run "sudo mv aws-cli... aws-bak".  Then see this posting for details about installing the AWS CLI.

Leave a comment

Your email address will not be published. Required fields are marked *