AWS Cannot Be Found after installing AWSCLI using Pip on Ubuntu (18.04) so I do this quick fix to help my OS find it (without having to edit PATH)

Note: this article assumes you’re on Python3,

Note: there is nothing wrong with editing the PATH, I just don’t like doing it because if I make a typo I can break a lot of stuff. If you’re going to edit the path, do a test run from the command line first with the export command. If that session isn’t completely broken, then you know it’s safe to add to ~/.bashrc (Note: bashrc will make your path change permanent between shell sessions, but just using the export command will not)

This documentation here:

https://docs.aws.amazon.com/cli/latest/userguide/install-linux.html#install-linux-awscli

says this:

I follow that exactly, I run: pip3 install awscli — upgrade — user, and then when I try to do aws on the command line, the os is unable to find my aws installation. I’m dead in the water. My Ubuntu is pretty freshly installed so it’s not like I have a mess of tangled pythons and pips all over the place muddling things.

You can see at the bottom of that screen cap a link to a troubleshooting page,

https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-troubleshooting.html

I try what it says here, I run ~/.local/bin/aws — version, using the absolute path and calling directly, and this works, I can see the version of awscli, so that’s good. I know now that it did install, the os just can’t find it. Usually at this point, I have to edit the PATH. I am actually not a fan of messing with the path. :( Maybe I am a coward.

Another easy way I have fixed this before though is to just install to my system, this will put it here: /usr/bin/aws instead of ~/.local/bin/aws. I don’t like this though, because this isn’t the way that Amazon said in their docs, and I kinnnnnnda like following the path they lay out for me whenever possible.

But just in case you still want to know how, I install to system using:

sudo apt install awscli

to install to the system. Everything just works, and I don’t have to mess with the PATH.

Let me remind you again, this is different mind you than installing the way they recommend using pip, screen shot again…

soooo, even though I got awscli working by installing to system, I really really really like to follow the docs absolutely whenever possible and stay on the golden path. So let’s stick to their way, and try to make it work,

You can use:

to uninstall your system version of AWS. This will not uninstall the one you have on ~/.local/bin/aws if you installed with pip and — user

In my opinion clean up is super important. You don’t want a mess on your hands. Have only one version installed.

Let’s stay on topic, If you do “which aws” and you’re not getting a result, it’s probably because the path to the executable is not in your path. If you type aws in the terminal, and you get nothing, even if you have just installed aws, it’s simply because the path to aws is not in your PATH. The os just can’t find it.

Heres one popular suggestion on how to add to your PATH:

Edit .bashrc in your home directory and add the following line:

That’s true, but when I did this:

I did this because that’s where I have aws installed, It broke everything and caused a bunch of conflicts between the system and the user versions of all the software I have installed. DO NOT DO THAT.

Instead of adding to the path, I am a fan of making an alias.

I added:

to the end of my ~/.bashrc file, called source ~/.bashrc and then called it a day.

To me this is just super simple and I don’t have to think about it very much. I like that. Did I mention I don’t have to touch the PATH?

Research and Development | Dev Ops | Software Engineer | Topaz Labs

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store