2

I'm trying to upgrade pip with sudo as follows:

kurt@kurt-ThinkPad:~$ sudo pip install --upgrade pip
[sudo] password for kurt: 
The directory '/home/kurt/.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/kurt/.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.
Requirement already up-to-date: pip in /usr/local/lib/python3.5/dist-packages

Although the message ends with "Requirement already up-to-date", if I do a pip command I get a warning that I'm not using the most recent version:

kurt@kurt-ThinkPad:~$ pip show dateutil
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

How can I upgrade pip properly?

Kurt Peek
  • 409

1 Answers1

4

You may use sudo's -H flag. It says there in the error message:

If executing pip with sudo, you may want sudo's -H flag.

So, correct way would be:

sudo -H pip install --upgrade pip

-H flag sets $HOME variable to the users home by the way.

razorx
  • 441
  • 3
  • 10