1

When I run aws --version I get this output:

File "/usr/local/bin/aws", line 19, in <module>
  import awscli.clidriver
File "/usr/local/aws/lib/python2.7/site-packages/awscli/clidriver.py", line 15, in <module>
  import logging
ImportError: No module named logging

I changed the path in bashprofile to reflect python3 change and this has been working fine for other applications, but AWS is still looking for v2.7.

How do I fix this error- do I update awscli, uninstall/reinstall, or something else?? I am not very familiar with bash/envs and don't want to mess with anything.

Nina
  • 79
  • 2
  • 10
  • 1
    If you have used pip to install awscli then you need to install it again using the pip of python 3. You can check the python for pip using `pip --version`. – isAif Jun 23 '20 at 16:02
  • Uninstalling may depend on how you installed it (you may not even remember), and what OS you are running (Mac/Linux?). This answer will likely be helpful: https://stackoverflow.com/a/49590551/2730380. – stefansundin Jun 23 '20 at 16:16
  • pip3 works! I forgot about that step. I used the install --upgrade command here: https://docs.aws.amazon.com/cli/latest/userguide/install-macos.html – Nina Jun 23 '20 at 16:21

1 Answers1

6

First check if you have pip3 by doing:

which pip3

Try to reinstall awscli using pip3, first uninstall it from 2.7 packages:

pip uninstall awscli
pip3 install awscli --upgrade --user

Note that this installs the CLI for your user only.

Now you can try

aws --version

mabergerx
  • 1,216
  • 7
  • 19