Getting warning file permission with root user

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.

Solution 1:

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.