5

I am installing aws cli on Mac. Previously I installed anaconda to control my python versions. So I installed python using conda. Now I want to install aws cli.

By using pip: pip3 install awscli --upgrade --user

The installation was successful. However, when I run aws --version It told me that aws command was not found.

I again tried to add it to the command line path. But I could not find where it was installed.

When I run which python It gave me /anaconda/bin/python

People say this might not be the real folder and it is true I could not find aws cli under it either. I then run ls -al /anaconda/bin/python It gives lrwxr-xr-x 1 mac staff 9 Aug 15 20:14 /anaconda/bin/python -> python3.6

I dont understand the path at all. How could I find where my aws cli installed?

djvg
  • 11,722
  • 5
  • 72
  • 103
user8486156
  • 147
  • 2
  • 7
  • Maybe this is caused by using the `--user` switch? See e.g. [this question](https://stackoverflow.com/q/42988977) and [pip docs](https://pip.pypa.io/en/stable/reference/pip_install/#cmdoption-user). Not sure, but I would guess this is not necessary when installing to a conda environment. – djvg Sep 14 '18 at 12:05

4 Answers4

3

I solved the problem by using conda to install awscli.

conda install -c conda-forge awscli 

worked so far. It seems that pip install does not work for conda installed python... Is this conclusion true?

Areza
  • 5,623
  • 7
  • 48
  • 79
user8486156
  • 147
  • 2
  • 7
  • You can install via pip for conda-installed python, though it was a little tricky to find the correct path. – abathur Jan 14 '18 at 18:57
  • 1
    FWIW, python's introspection can help you figure some issues like this out. I ran conda's python, then `import awscli` and `help(awscli)`. The help info reports the module's file as: `/Users//.local/lib/python3.6/site-packages/awscli/__init__.py`, which is how I knew to look in `~/.local/bin`. In case you aren't familiar, `q` will exit the help reader. – abathur Jan 14 '18 at 19:01
3

I ran into the same issue and eventually found the awscli command in ~/.local/bin. Just add /Users/<username>/.local/bin to your $PATH.

You can do this by editing ~/.bash_profile, which probably already has these lines in it:

# added by Anaconda3 4.4.0 installer
export PATH="/Users/<username>/anaconda/bin:$PATH"

You could make another copy of this line but replace the anaconda path with the new one, but I just updated the existing path since the two are related:

# added by Anaconda3 4.4.0 installer
export PATH="/Users/<username>/.local/bin:/Users/<username>/anaconda/bin:$PATH"
abathur
  • 1,047
  • 7
  • 19
0

If it's installing and then saying "command not found" it probably just means that the executable it has installed is not referenced in the operating systems PATH environment variable.

Here is how to add the downloaded executable to PATH: https://docs.aws.amazon.com/cli/latest/userguide/cli-install-macos.html#awscli-install-osx-path

Here is the AWS docs to troubleshoot the issue: https://docs.aws.amazon.com/cli/latest/userguide/troubleshooting.html

Moe
  • 2,672
  • 10
  • 22
0

I encountered an identical situation.

I solved this by adding the location of the awscli command to the file...

/etc/paths

The location to my awscli command was where others had found it...

~/.local/bin

From my home directory in Mac OS X Terminal, I entered a quick nano command to edit the /etc/paths file...

sudo nano /etc/paths

#For those who don't know...
#sudo is to get admin access
#nano is quick and dirty file editor.
# /etc/paths is the file you want to edit.

I entered my password, then I just added the awscli command location at the end of the file...

/Users/UpAndAtThem/.local/bin

Yours might be be...

/Users/your_username_here/.local/bin

Still in Nano editor to exit and save: Hit control+X > Hit Y > Hit Enter.

Here's a quick video...

https://youtu.be/htb_HTwtgmk

Good luck!

P A
  • 11
  • 3