Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

aws CLI unable to be used due to module colorama

aI've installed AWS CLI and am trying to use it on Mac OS Sierra. It complains there is is no module colorama:

$ aws

Traceback (most recent call last):
  File "/usr/local/bin/aws", line 19, in <module>
    import awscli.clidriver
  File "/Library/Python/2.7/site-packages/awscli/clidriver.py", line 26, in <module>
    from awscli.formatter import get_formatter
  File "/Library/Python/2.7/site-packages/awscli/formatter.py", line 19, in <module>
    from awscli.table import MultiTable, Styler, ColorizedStyler
  File "/Library/Python/2.7/site-packages/awscli/table.py", line 18, in <module>
    import colorama
ImportError: No module named colorama

So I try to install it and it says the requirement is already satisfied:

$ sudo pip install colorama

The directory '/Users/danniu/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/danniu/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: colorama in /Users/danniu/Library/Python/2.7/lib/python/site-packages
like image 709
user3871 Avatar asked Mar 25 '17 21:03

user3871


People also ask

Why my AWS CLI is not working?

If the aws command cannot be found after first installing or updating the AWS CLI, you might need to restart your terminal for it to recognize any PATH updates. If the aws command cannot be found after first installing or updating the AWS CLI, it might not have been fully installed.

How do you check if AWS CLI is configured correctly?

Use the describe-configuration-recorder-status command to check that the AWS Config has started recording the configurations of the supported AWS resources existing in your account. The recorded configurations are delivered to the specified delivery channel.

Why AWS configure is not working?

Possible fixes: The most common cause for this error is that a credentials file already exists. Browse to ~/. aws and look for a file named credentials . Rename or delete that file, and then run aws configure again.

Is not recognized as an internal or external command operable program or batch file AWS?

'aws' is not recognized as an internal or external command, operable program or batch file. This issue occurs when the path of the CLI installed path is not given along with aws command. 1) For Solution, enter CR with a Workaround if a direct Solution is not available.


2 Answers

Don't install Python modules with sudo. If you add the --user command line option, this will install the package into your home folder (which your user owns) and you won't need to use sudo.

If you want this to be default, you can create a pip.conf file with the following contents:

[install]
user = true

located where it should on your given operating system (on macOS Sierra it's located at $HOME/Library/Application Support/pip/pip.conf).

The easiest solution to your problem is to run

$ pip install --upgrade --user awscli

as this will make sure you have all needed dependencies.

like image 106
Julien Avatar answered Oct 05 '22 11:10

Julien


I've faced this issue on MacOS Sierra and below command solved the issue.

pip install --ignore-installed six --upgrade --user awscli

Read more about why to use --ignore-installed six on github issue raised for installing the awscli on mac. https://github.com/pypa/pip/issues/3165.

Also read AWS Doc on how to install AWS CLI :- http://docs.aws.amazon.com/cli/latest/userguide/installing.html

like image 44
Amit Avatar answered Oct 05 '22 09:10

Amit