Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

awscli not added to path after installation

I installed the aws cli according to the offical Amazon directions.

sudo pip install awscli 

However, aws is nowhere to be found in my path. The installation seems to have been successful. There are a number of files located at /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/awscli, however there are no executables named aws. My python version is 3.3.4, my pip version is 1.5.4, and running this command on OS X 10.9. What could be wrong?

Thanks!

like image 849
Max Avatar asked Apr 28 '14 03:04

Max


People also ask

Where is AWS CLI installed?

By default, the AWS CLI version 1 installs to C:\Program Files\Amazon\AWSCLI (64-bit version) or C:\Program Files (x86)\Amazon\AWSCLI (32-bit version). To confirm the installation, use the aws --version command at a command prompt (open the Start menu and search for cmd to start a command prompt).

What is PIP install AWS CLI?

$ pip install awscli --upgrade --userThe --upgrade option tells pip to upgrade any requirements that are already installed. The --user option tells pip to install the program to a subdirectory of your user directory to avoid modifying libraries used by your operating system.

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.


1 Answers

Improving the OP's Answer

The OP answered their own question, but the exact location of the executable is more likely to be different than it is to be the same. So, let's break down WHY his solution worked so you can apply it to yourself.

From the problem

There are a number of files located at /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/awscli, however there are no executables named aws.

From the solution

The solution was to add /Library/Frameworks/Python.framework/Versions/3.3/bin to the my PATH.

Let's learn something

Compare those paths to find their commonality:

/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/awscli /Library/Frameworks/Python.framework/Versions/3.3/bin 

Notice that they diverge at lib vs. bin. And consider that the OP stated, "there are no executables named aws." That brings us to our first learning lessons:

  • Executables tend to not be in lib folders.
  • Look for bin folders that share a common lineage.

In this case I would have suggested looking for bin folders via:

find /Library/Frameworks/Python.framework -type d -name bin 

But, if you are going to do that, you might as well just search for your executable via:

find /Library/Frameworks/Python.framework -type f -perm -100 -name aws # the `-` in `perm -100` means not an exact match of 100 # but any octal that includes 100 

But wait

How did OP know to look in their /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/?

The easiest answer is also our next learning lesson:

  • Ask your python where things are installed.

Here is how I do that:

$ python -c 'import awscli; print(awscli)' <module 'awscli' from '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/awscli/__init__.pyc'>  $ python3 -c 'import awscli; print(awscli)' <module 'awscli' from '/System/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/awscli/__init__.py'> 

I have 2 Pythons and neither of them use the same paths or even path patterns as the OP.

Apply what we've learned

$ find /System/Library/Frameworks/Python.framework -type d -name bin /System/Library/Frameworks/Python.framework/Versions/2.7/bin /System/Library/Frameworks/Python.framework/Versions/3.6/bin  $ find /System/Library/Frameworks/Python.framework -type f -perm -100 -name aws /System/Library/Frameworks/Python.framework/Versions/2.7/bin/aws /System/Library/Frameworks/Python.framework/Versions/3.6/bin/aws 

As you can see, I have 2 bin folders and 2 aws executables. I probably want to use the Python3.6 version. However, if I'm doing local trial and error work for a remote system that uses the Python2.7 version, I'm going to want to use that. And this is exactly why I have 2 version installed.

like image 53
Bruno Bronosky Avatar answered Oct 05 '22 04:10

Bruno Bronosky