Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip doesn't work after upgrade

Tags:

python

pip

pypi

Today I upgraded from pip 7.1.0 to 7.1.2, and now it doesn't work.

$ pip search docker-compose
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 223, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/search.py", line 43, in run
    pypi_hits = self.search(query, options)
  File "/Library/Python/2.7/site-packages/pip/commands/search.py", line 60, in search
    hits = pypi.search({'name': query, 'summary': query}, 'or')
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1240, in __call__
    return self.__send(self.__name, args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1599, in __request
    verbose=self.__verbose
  File "/Library/Python/2.7/site-packages/pip/download.py", line 788, in request
    return self.parse_response(response.raw)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1490, in parse_response
    return u.close()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 799, in close
    raise Fault(**self._stack[0])
Fault: <Fault 1: "<type 'exceptions.KeyError'>:'hits'">

So I tried reinstalling:

sudo -H pip install --force-reinstall -U pip

The reinstall ran without error, but when I tried to search, I got the same error.

So, I tried reinstalling the old version:

sudo -H pip install --force-reinstall -U pip==7.1.0

Again, the reinstall worked, but searching was still broken after the reinstall. In addition to the error, I did get the version upgrade message:

You are using pip version 7.1.0, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Disabling the cache also gives the same error:

pip search docker-compose --no-cache-dir --disable-pip-version-check

The problem seems to only be with the search function, as pip still functions well enough to reinstall itself and such.

I believe I have only installed one other package today, which was docker-compose. The problem occurs when I search for packages other than docker-compose, as in my examples.

Any ideas?

like image 382
Travis Avatar asked Sep 11 '15 20:09

Travis


2 Answers

I wasn't able to reproduce this with pip 7.1.2 and either Python 2.7.8 or 3.5.1 on Linux.

The xmlrpclib docs have this to say on 'faults':

Method calls may also raise a special Fault instance, used to signal XML-RPC server errors

This implies that pip is reporting a problem on the server (pypi) side.

The Python Infrastructure Status site reports problems with pip search on 2015-09-11 and 2015-09-12.

I suspect that this is not a bug in pip, but a problem with pypi.python.org on the dates in question.This question was asked on 2015-09-11.

A similar error was logged on the pypi bitbucket repo on 2015-09-11, reinforcing my theory.

Interestingly, there is another similar bug logged at pypi's github repo. In this case the search term is a regex:

pip search "^docker-compose$"

I can reproduce this error on Python 2.7.8 and Python3.5.1, pip-7.1.2 and pip-8.1.1 on Linux; however I can't see anything in the pip documentation to suggest that pip search supports regex, and this answer states regex is unsupported, so I think this is a separate issue unrelated to the OP's question.

like image 50
snakecharmerb Avatar answered Sep 28 '22 11:09

snakecharmerb


pip does this sometimes if no matches (hits) are found:

$ pip search '':

Fault: <Fault 1: "<type 'exceptions.KeyError'>:'hits'">

$ pip search 'something':

OK

Could also be a server side bug, one that fails to provide the needed info. So, the fixing has to be done by pip devs, or server devs, or both.

like image 29
totoro Avatar answered Sep 28 '22 10:09

totoro