pip: pip upgrade fails - says "owned by OS"

pip install --upgrade six
Downloading/unpacking six from https://pypi.python.org/packages/3.3/s/six/six-1.9.0-py2.py3-none-any.whl#md5=9ac7e129a80f72d6fc1f0216f6e9627b
  Downloading six-1.9.0-py2.py3-none-any.whl
Installing collected packages: six
  Found existing installation: six 1.5.2
    Not uninstalling six at /usr/lib/python2.7/dist-packages, owned by OS
Successfully installed six
Cleaning up...

===========================================
pip 1.5.4 from /usr/lib/python2.7/dist-packages (python 2.7)
===========================================
cat lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.2 LTS"

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 20 (5 by maintainers)

Most upvoted comments

TLDR;

  • You can remove previous installation via $ sudo apt-get remove python-pip or,
  • You can simply force the installation via pip install --ignore-installed six

I don’t think this is a bug.This might clear the confusion: http://askubuntu.com/questions/644911/unable-to-upgrade-pip.

Theapt system and PyPI uses two different mechanisms.

This is due to the fact that six was installed via apt rather than pip.

$ sudo apt-get remove python-pip Completely solves problem for me.

Owned by the OS is a Debian patch. I suggest filing a bug there and reinstalling pip using get-pip.py.

Sent from my iPhone

On Aug 25, 2015, at 4:48 PM, Duco notifications@github.com wrote:

Same problem here. @xavfernandez result is:

[six 1.9.0 (/usr/local/lib/python2.7/dist-packages), six 1.5.2 (/usr/lib/python2.7/dist-packages)]

— Reply to this email directly or view it on GitHub.

Actually, the problem is that pip by OS/system means root. Not sudo cmd or sudo -s Try doing sudo -i, then as root, in root’s ENV, do the: pip install pip --upgrade and it will work just fine.

Its always BEST to sudo -i before install pip applications if you are intending them to be system wide.

better do sudo rm -rf /usr/lib/python2.7/dist-packages/six-1.5.2.egg-info

This should fix the problem, as it fixed mine on Ubuntu 14.x install pip (even if it is already installed), securely download get-pip.py from here https://pip.pypa.io/en/stable/installing/ Then run the following: sudo python get-pip.py

I have same problem as temp solution remove six by hand rm /usr/lib/python2.7/dist-packages/six see https://github.com/testing-cabal/mock/issues/298