m4verick
m4verick

Reputation: 89

Problems to upgrade pip to pip3

I trie to upgrade pip to pip3 and I found 2 problems.

1) The diectory where is the pip chache it had no access to my useradmin o my root user.

2) Linux has by default python2.7, I've both python2.7 and python3.5 installed. But for some reason, the O.S. think I've only installed python2.7 so at this point PIP is up to date, how can I set by default python3.5 (or set both of then) to achive install pip3 ?

xxxx@yyyy:~$ pip3 install virtualenv
Collecting virtualenv
  Downloading virtualenv-15.1.0-py2.py3-none-any.whl (1.8MB)
    100% |████████████████████████████████| 1.8MB 579kB/s 
Installing collected packages: virtualenv
Successfully installed virtualenv-15.0.3
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
xxxx@yyyyy:~$ sudo pip install --upgrade pip
[sudo] password for xxxx: 
The directory '/home/xxxx/.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/xxxx/.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/python2.7/dist-packages
enter code here

Upvotes: 1

Views: 1196

Answers (2)

ravnsgaard
ravnsgaard

Reputation: 932

pip3 is a separate command from pip. What you want to do is:

pip3 install --upgrade --user pip

This will install an updated pip3 in your home folder; on my machine it is ~/.local/lib/python3.5/site-packages. By not using sudo and installing globally, you avoid messing with the version that your package manager provides. Hence the --user option.

The wording of the warning from pip3 is because pip always assumes it is the only installed version, which is rarely the case on a linux box.

Also, you cannot install pip3 for your python2 installation. It really just is pip for python3.

Upvotes: 2

mgracer
mgracer

Reputation: 175

You can simply just do "sudo python3 -m pip install " instead of setting the default python which could cause some issues.

Upvotes: 1

Related Questions