简体   繁体   中英

pip doesn't work after upgrade

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?

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.

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.

When I didn't receive an answer to this question last year, I posted an issue on GitHub , and it was determined my issue was caused by the PyPi/pip server being down (just the search part, I guess).

I can't be certain, but it seems like there were more comments/answers to this question when it was active last year. I really thought someone had posted that answer here (at least in a comment or something), but it's obviously not here now.

I think @tedder42 is having a different problem than I did because there hasn't been any recent downtime at PyPi. Even if someone posted the real answer to his question, I would have no way to verify it. So, I think the best course of action is to ignore his bounty, and if he's still having the problem, it should be turned into a new question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM