pip upgrade fails - says "owned by OS"

Created on 7 Jul 2015  ·  20Comments  ·  Source: pypa/pip

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"
auto-locked support

Most helpful comment

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.

All 20 comments

You were root when doing this right? Did you have six installed from your repository's package manager?

Why are you saying this failed? It should have successfully installed six into /usr/local/lib/python2.7/dist-packages/. It just skipped uninstall the version of six that was installed by the OS.

I have the same problem,

$ sudo 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...

After this I still have the version six 1.5.2 installed while I need version 1.9.0
I also tried uninstalling six ($ sudo pip uninstall six)
but it always tells me " not uninstalling six, owned by OS"

What is the result of running python -c "from pkg_resources import Environment;print(Environment()['six'])" ?

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

Possibly a badly ordered Python path ?

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)]

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 [email protected] 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.

Going to close this since it's Debian's patch that is causing this.

@prescripio I also met this problem. Then I removed pip using

sudo pip uninstall pip

Then I installed the newest version 7.1.2. Everything seems to be fine now.

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

  • 下载six源码
  • 解压tar -zxvf six**
  • 切换six**路径,并执行sudo python setup.py install
  • 如果还不行,在/usr/local/lib/python2.7/dist-packages/下,新建mypack.pth文件,输入以下内容

    # 文件内容
    /usr/local/lib/python2.7/dist-packages/
    
    • 新建这个文件的作用是,Python的搜索路径先搜搜/usr/local/lib/,后搜搜/usr/lib

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.

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.

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

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

I made a permanent solution check this out -

Uninstall pip if any - use

sudo pip uninstall pip

Go to this link - https://www.liquidweb.com/kb/how-to-install-pip-on-ubuntu-14-04-lts/

For me it installed in

vagrant@vagrant-ubuntu-trusty-64:/vagrant$ which pip
/usr/local/bin/pip

So there is a mistake in the post as the command pip --help

will not work.

vagrant@vagrant-ubuntu-trusty-64:/vagrant$ pip --help
-bash: /usr/bin/pip: No such file or directory

But you still have pip installed.

Enjoy!

Should I submit a patch?

Try this:
sudo easy_install -U pip

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings