5

When I run sudo pip install --upgrade six I run into the issue below:

2016-01-20 18:29:48|optim $ sudo pip install --upgrade six Collecting six Downloading six-1.10.0-py2.py3-none-any.whl Installing collected packages: six Found existing installation: six 1.4.1 Detected a distutils installed project ('six') which we cannot uninstall. The metadata provided by distutils does not contain a list of files which have been installed, so pip does not know which files to uninstall.

I have Python 2.7, and I'm on Mac OS X 10.11.1.

How can I make this upgrade successful?

(There are other kind of related posts, but they do not actually have a solution to this same error.)

EDIT:

I am told I can remove six manually by removing things from site-packages. These are the files in site-packages that begin with six:

six-1.10.0.dist-info, six-1.9.0.dist-info, six.py, six.py.

Are they all correct/safe to remove?

EDIT2:

I decided to remove those from site-packages, but it turns out the existing six that cannot be installed is actually in
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python.
There I see the files:
six-1.4.1-py2.7.egg-info, six.py, six.pyc but doing rm on them (with sudo, even) gives Operation not permitted. So now the question is, how can I remove those files, given where they are?

tscizzle
  • 11,191
  • 15
  • 54
  • 88
  • You can always go to .../python2.7/site-packages/ and manually remove the folder of the six package. – Zoltan Fedor Jan 20 '16 at 23:47
  • Mm, nice. Good call. I thought of that but is there a way to know what to remove manually? – tscizzle Jan 21 '16 at 02:22
  • Yes. Search for the "site-packages" folder and then you should find where your python 2.7 stores its modules. It should be in the form of ..../python2.7/site-packages/ In this folder you will find a subfolder called six and potentially another folder for six egg info. Delete both and that is it. – Zoltan Fedor Jan 21 '16 at 02:44
  • I have these files in my site-packages: `six-1.10.0.dist-info`, `six-1.9.0.dist-info`, `six.py`, `six.pyc` Are they all safe to remove? – tscizzle Jan 21 '16 at 14:45
  • Yes, they are. I mean "safe" - you are nuking the six module, so it is as safe as not having a six module can be safe. For example if you have some other packages depending on the six module, then they won't work anymore, but assuming your goal in nuking the six module is to reinstall it immediately, then yes, it is "safe". – Zoltan Fedor Jan 21 '16 at 17:32
  • 1
    @ZoltanFedor sweet. see my EDIT 2? i just removed those, but turns out the existing `six` is not coming from site-packages. There's another one, but it's not letting me remove. – tscizzle Jan 21 '16 at 17:33
  • Those files in your EDIT 2 are definitely for the SIX package. You should be able to remove them as admin, if not, then the usual filesystem troubleshooting: 1. checking your rights, 2. checking file permissions, 3. checking locks, 4. checking disk integrity, etc. I don't use Mac, so I can't help you with how to get these down on a Mac, but these are standard things you can do in every OS when you want to delete a file and you are not "allowed". – Zoltan Fedor Jan 21 '16 at 17:36

2 Answers2

4

Looks like a known bug in pip 8, which is now being fixed (see Change 260150 )

Until this is resolved you can downgrade to pip 7.1.2

Amos
  • 427
  • 4
  • 6
  • 2
    It looks as though it was an intended change in behavior (from warning to fatal error) rather than a bug (see https://github.com/pypa/pip/issues/3384). – Talia Jan 21 '16 at 15:29
1

I, too, have had some issues with installing modules, and I sometimes find that it helps just to start over. In this case, it looks like you already have some of the 'six' module, but isn't properly set up, so if sudo pip uninstall six yields the same thing, go into your directory and manually delete anything related to six, and then try installing it. You may have to do some digging where you have your modules are stored (or have been stored, as pip can find them in different locations).

MANA624
  • 986
  • 4
  • 10
  • 34