0

When I try to upgrade awsli: pip install awscli --upgrade, I get the following error: Traceback (most recent call last):

  File "/usr/local/bin/pip", line 7, in <module>
    from pip._internal import main
ImportError: No module named _internal

Following the instructions on Stackoverflow: pip: no module named _internal Then I get the following errors:

python2.7 get-pip.py --user --force-reinstall
Collecting pip
  Using cached https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl
botocore 1.9.22 requires docutils>=0.10, which is not installed.
awscli 1.14.69 requires colorama<=0.3.7,>=0.2.5, which is not installed.
awscli 1.14.69 requires docutils>=0.10, which is not installed.
awscli 1.14.69 requires rsa<=3.5.0,>=3.1.2, which is not installed.
awscli 1.14.69 requires s3transfer<0.2.0,>=0.1.12, which is not installed.
Installing collected packages: pip
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/home/porter/.local/lib/python2.7'
Check the permissions.

You are using pip version 8.1.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

So, all in all it is a great mess. I don't think that upgrading to pip version 10.0.1 will do any good.

Edit: I found the culprit: /home/porter/.local/lib/python3.5. In this folder, there are the site-packages that pip is asking about: colorama, docutils, rsa, s3 etc.

What to do now? awscli is installed at: /usr/local/lib/python2.7/dist-packages/awscli

but its dependencies are installed at: /home/porter/.local/lib/python2.7/

so upgrading awscli, even after changing the permissions, doesn't work. Maybe it is better to deinstall awscli alltogether? But how?

user3467407
  • 101
  • 3

2 Answers2

0

It appears that you have files in your home directory that aren't owned by you. This is the common result of using the sudo command improperly at some point in the past. Find these files with:

find $HOME -not -user $USER -exec ls -lad {} \;

and change ownership back to you with the chown command.

OregonJim
  • 326
  • 2
  • 10
0

I got it done. It needs a few steps though.
1. I deleted the site-packages in /home/porter/.local/lib/python2.7/
2. I then removed awscli with this command: sudo python -m pip uninstall awscli

I had to use the python -m command. Otherwise I got the above-mentioned error:

  File "/usr/local/bin/pip", line 7, in <module>
    from pip._internal import main
ImportError: No module named _internal
user3467407
  • 101
  • 3