0

I have python version 2.7.12 and the location is -

/usr/bin/python

I have the pip version as below -

pip 18.1 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)

Pip location is -

/usr/local/bin/pip

I execute the following -

sudo pip install awscli --upgrade --user

It returns - "Successfully installed awscli-1.16.73"

Now when i execute aws on command line i get the following -

Traceback (most recent call last):
  File "/home/Dan/.local/bin/aws", line 19, in <module>
    import awscli.clidriver
ImportError: No module named awscli.clidriver

I am stuck here. I think pip is installing awscli into a different directory. Any help is deeply appreciated.

Dan
  • 801
  • 2
  • 14
  • 29
  • Are you using the aws cli inside python? Is there any reason you don't just use Boto3? https://boto3.amazonaws.com/v1/documentation/api/latest/index.html – caterpree Dec 12 '18 at 14:20
  • I followed the following - https://docs.aws.amazon.com/cli/latest/userguide/install-linux.html. I had installed using the package manager on ubuntu but realized that it is not updated so went though the pip route – Dan Dec 12 '18 at 14:22
  • In the installation text i also see a message - **Requirement already satisfied: six>=1.5 in /home/Dan/.local/lib/python2.7/site-packages (from python-dateutil<3.0.0,>=2.1; python_version >= "2.7"->botocore<1.13.0,>=1.12.63->boto3) (1.11.0)** – Dan Dec 12 '18 at 14:26
  • Ahh okay, misread question slightly, please refer to this answer here: https://stackoverflow.com/questions/43873663/awscli-fails-to-work-no-module-named-awscli Namely try the `pip uninstall awscli` then `pip install awscli` without the upgrade/user part. I think because of the --user it didn't install in the correct place and can't be found. – caterpree Dec 12 '18 at 14:27
  • Did the uninstall and install. It tells me again `Successfully installed awscli-1.16.73` but again when i execute aws i get `bash: /home/Dan/.local/bin/aws: No such file or directory`. So i execute **bash** to reload bash and i get `Traceback (most recent call last): File "/usr/local/bin/aws", line 19, in import awscli.clidriver File "/usr/local/lib/python2.7/dist-packages/awscli/clidriver.py", line 24, in from botocore.history import get_global_history_recorder ImportError: No module named history` – Dan Dec 12 '18 at 14:36
  • 1
    Okay, can you check the permissions on the `.local` folder and make sure your user owns them, because you ran it as sudo you may have messed up permissions on that part. `sudo chown -R $USER ~/.local` will fix that if you need to. – caterpree Dec 12 '18 at 14:38
  • cool. `chown` did it. I was the owner of the .local directory but i think the permissions were not correct or internal directories. Thanks a lot :). You can post this as the answer so that i can accept. – Dan Dec 12 '18 at 14:46
  • Glad to hear, posted! – caterpree Dec 12 '18 at 14:50

1 Answers1

2

Can you check the permissions on the .local folder and make sure your user owns them, because you ran it as sudo you may have messed up permissions on that part. sudo chown -R $USER ~/.local will fix that if you need to.

caterpree
  • 591
  • 2
  • 7