AWS-CLI installed but not working (Command 'aws' not found) Ubuntu 18.04. How to solve it?

Following these steps to install AWS-CLI in a brand new Ubuntu 18.04:

  1. sudo apt update
  2. sudo apt upgrade
  3. sudo apt install python3-pip
  4. sudo apt install npm (I will working with NodeJS)
  5. pip3 install awscli --upgrade --user

After the step 5 I should be able to see the aws-cli version. But this is what I get:

  1. aws --version

    Command 'aws' not found, but can be installed with:

    sudo apt install awscli (I did nothing)

But If I check in ll ~/.local/binThis is what I have:

drwxrwxr-x 2 ubuntu ubuntu 4096 Jun 22 15:46 __pycache__/
-rwxrwxr-x 1 ubuntu ubuntu 815 Jun 22 15:46 aws*
-rwxrwxr-x 1 ubuntu ubuntu 1432 Jun 22 15:46 aws.cmd*
-rwxrwxr-x 1 ubuntu ubuntu 204 Jun 22 15:46 aws_bash_completer*
-rwxrwxr-x 1 ubuntu ubuntu 1136 Jun 22 15:46 aws_completer*
-rwxrwxr-x 1 ubuntu ubuntu 1807 Jun 22 15:46 aws_zsh_completer.sh*
  1. If I run python3 -m awscli --version this is what I get:

    aws-cli/1.18.84 Python/3.6.9 Linux/4.15.0-1065-aws botocore/1.17.7

So it seems that aws-cli is installed and already in ~/.local/bin but not respond to the aws configure command.

What am I missing?

UPDATE


This is what have in the $PATH

echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
3

1 Answer

~/.local/bin is not currently in your $PATH because it did not exist when you opened your shell.

Log out and log back in to fix this problem.


To explain, if you take a look at your ~/.profile file, you will see the following lines:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then PATH="$HOME/.local/bin:$PATH"
fi

If you look closely, you will see that $HOME/.local/bin will be added to your path if and only if it exists.

So, the first time you install something locally with pip, you will need to log out and log back in.


Alternatively, you can also source your ~/.profile file if you don't want to log out:

source ~/.profile

or

. ~/.profile
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like