50

I am trying to set up an "Amazon Elastic Container Registry" but I get the following error when using this command: aws ecr get-login --no-include-email --region us-west-2:

Unknown options: --no-include-email

The manual redirects me when this occurs to go to the following page, in order to update my aws cli. https://docs.aws.amazon.com/cli/latest/userguide/installing.html

Which in short means, call pip install awscli --upgrade --user. While that works, my cli is not updated. So I removed it at all pip uninstall awscli. But I still had the aws command available, also when I opened a new session in the terminal...

So I assume I haven't installed my aws cli via pip, but I can not figure out how it does is installed. Can anyone help me out and give me some directions to resolve this issue. So I can remove the current awscli, and install a new version via pip install awscli --upgrade --user

user007
  • 1,557
  • 3
  • 16
  • 24
  • 1
    I am on OSX btw, in case that might change the answer – user007 Feb 01 '18 at 22:06
  • 1
    Did you install using brew? – jarmod Feb 01 '18 at 23:14
  • 1
    Possible duplicate of: https://stackoverflow.com/questions/36969391/how-to-upgrade-aws-cli-to-the-latest-version? [Restart may be the answer too...] – demokritos Feb 02 '18 at 19:58
  • Installation was done by brew indeed, so uninstalling via brew resolved the issue. So not a duplicate since restarting didn't resolved the issue. The question is similair though, how can I find how AWS-CLI is installed – user007 Feb 05 '18 at 10:56

9 Answers9

65

I had a similar issue. Answering in case someone else does too. I think I had originally installed it without pip like this: https://docs.aws.amazon.com/cli/latest/userguide/awscli-install-bundle.html. So you just need to uninstall it like this (as instructed in above link):

$ sudo rm -rf /usr/local/aws
$ sudo rm /usr/local/bin/aws

Then you can re-install it with pip3: https://docs.aws.amazon.com/cli/latest/userguide/cli-install-macos.html

Basically:

pip3 install awscli --upgrade --user

Then add it to your path

export PATH=/Users/yourname/Library/Python/3.6/bin/:$PATH
Morgan
  • 1,280
  • 1
  • 14
  • 15
  • 1
    After deleting the python2 version and installing the python3 version, where does the binary go? After installing awscli and then doing a which aws, it's not found. – u84six Aug 28 '18 at 21:52
  • 2
    Suggest you to modify the file **~/.bash_profile** adding the export command mentioned by Morgan and restart your terminal and then try **aws --version**. It worked perfectly for me. – KPandian Apr 23 '19 at 21:12
38

On ubuntu :

sudo apt-get remove --auto-remove awscli

ln -s /home/ubuntu/.local/bin/aws /usr/bin/aws
Amit Meena
  • 2,884
  • 2
  • 21
  • 33
15

Uninstall awscli.

pip uninstall awscli -y
Sebastián Palma
  • 32,692
  • 6
  • 40
  • 59
bosari
  • 1,922
  • 1
  • 19
  • 38
9

I had the same issue, but unlike Morgan, I prefer to use Homebrew to maintain all my dependencies in a single place.

So what I did was:

1 - uninstall awscli (was installed with pip - python2)

$ sudo rm -rf /usr/local/aws
$ sudo rm /usr/local/bin/aws

2 - Install awscli using homebrew

$ brew install awscli

Homebrew will install awscli inside Cellar folder: /usr/local/Cellar/awscli

Note: I also have python3 installed through Hombrew.

Links:

Enrique Lopez
  • 174
  • 2
  • 5
6

If you are using mac and used brew to install aws cli. Use brew uninstall awscli and try brew install awscli

Davy Jones
  • 111
  • 1
  • 2
5

First try to get the path of the installation by using this command in Linux or mac

which aws-cli

After you get the installation location try removing the directory by using

sudo rm -rf "/path resultant from previous command"
Red Gundu
  • 183
  • 2
  • 10
1

In case if someone has installed aws-cli using Snap,then following method might be helpful :

First, open the Linux terminal and run the following command in it:

sudo snap remove aws-cli

The basic command line to remove a snap package is

sudo snap remove < package >

You have to put the name of a specific application instead of < package > Once you execute the command successfully, the terminal will ask you to enter the [sudo] password you put for the installation, but if you don’t have any password, press Enter to process it.

After completion of this procedure, you will see that aws-cli gets uninstalled from the system. However, the folder of aws is still present in the snap folder, so execute the following command to remove it:

sudo snap rm -r aws-cli

Vipul Patil
  • 1,250
  • 15
  • 27
0
  1. Remove respective bin & config files:
  • rm -rf /usr/local/bin/saml2aws
  • rm -rf ~/.aws/config
  • rm -rf ~/.aws/credentials
  1. Reinstall using the 'install.sh' script
Suprith
  • 61
  • 1
  • 4
0

I tried this on linux and it seemed to work sudo yum erase awscli

and get me to a place where when I run:

aws --version
zsh: command not found: aws
Sheetal Kaul
  • 3,029
  • 2
  • 13
  • 6