3

What does this warning mean? I got it when executing following command using root at amazon ec2 Ubuntu 14.04 LTS instance:

$ pip install https://github.com/troeger/opensubmit/archive/0.6.2.tar.gz
The directory '/home/ubuntu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

2 Answers 2

3

Well, your question partly has an answer in the quote:

You are using sudo to gain root permissions, but the way you are using sudo does not adjust the value of $HOME, so pip tries to install into the pip directory of the user who invoked sudo.

This might cause problems if the actual user would want to remove or change the installed modules, therefore the warning.

To avoid the warning and unless you don't have to, use pip without root/sudo or invoke sudo as sudo -H which will set $HOME to the user you are changing to, in this case /root.

0

This message hints at the fact that you might have executed pip earlier using sudo for the then-issued command.

For example

sudo pip install https://github.com/troeger/opensubmit/archive/0.6.2.tar.gz

Per default, sudo does not change the environment variable HOME and therefore sudo env | grep HOME is printing HOME=/home/username. Adding -H to the sudo command changes this behaviour and it prints HOME=/root.

To solve your problem you should make sure every folder in this path /home/ubuntu/.cache/pip/http (except / and /home) is owned by ubuntu:

sudo -H chown -R ubuntu: /home/ubuntu/.cache
1
  • The folders and subfolders seem to already be owned by the correct user. The problem is the invocation of sudo, as the questioner mentioned he's using root to install. Jan 17, 2017 at 13:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .