pypa / pip

The Python package installer
https://pip.pypa.io/
MIT License
9.52k stars 3.03k forks source link

`pip search pam` returns `xmlrpc.client.Fault:` #5435

Closed madonius closed 6 years ago

madonius commented 6 years ago

Environment

Description

> $ pip search pam                                                                                                            
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/basecommand.py", line 228, in main
    status = self.run(options, args)
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/commands/search.py", line 48, in run
    pypi_hits = self.search(query, options)
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/commands/search.py", line 65, in search
    hits = pypi.search({'name': query, 'summary': query}, 'or')
  File "/usr/lib/python3.6/xmlrpc/client.py", line 1112, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python3.6/xmlrpc/client.py", line 1452, in __request
    verbose=self.__verbose
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/download.py", line 792, in request
    return self.parse_response(response.raw)
  File "/usr/lib/python3.6/xmlrpc/client.py", line 1342, in parse_response
    return u.close()
  File "/usr/lib/python3.6/xmlrpc/client.py", line 656, in close
    raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault -32500: 'application error'>
> $ pip search abc                                                                                                            
micropython-abc (0.0.1)  - Dummy abc module for MicroPython
ABC (0.0.0)              - UNKNOWN
recursive-abc (0.1.0)    - A package to simplify the creation and manipulation of recursive data structures.
django-abc (1.0.0)       - extension to django inheritance for automatically casting base to appropriate subclass
ycytest (1.3.0)          - abc
cosmoabc (1.0.9)         - Python ABC sampler
pabc (0.1.1)             - Massively parallel ABC for Python
payce (0.1.1)            - Massively parallel ABC for Python
draco (0.1.1)            - Massively parallel ABC for Python
dramatic (0.1.1)         - Massively parallel ABC for Python
dirac (0.1.1)            - Massively parallel ABC for Python
elfi (0.7.1)             - Modular ABC inference framework for python
pyabc (0.8.19)           - Distributed, likelihood-free ABC-SMC inference
visage (0.3.0)           - Loosely coupled, ABC based, Python Interface Registry
abcplus (0.1.0)          - An amplified version of abc for Abstract Base Classes plus more
astroabc (1.4.2)         - A Python implementation of an Approximate Bayesian Computation Sequential Monte Carlo (ABC SMC)
                           sampler for parameter estimation.
abcpy (0.5.0)            - A framework for approximate Bayesian computation (ABC) that speeds up inference by parallelizing
                           computation on single computers or whole clusters.

Same behaviour can be observed with pip3

Expected behavior

To get a list of packages containing pam in their name or description. Similar to the PyPi search

How to Reproduce

  1. Get package from the OS or the get-pip.py script
  2. Then run 'pip search pam`
  3. An error occurs.

Output

Paste the output of the steps above, including the commands themselves and
pip's output/traceback etc.
toke commented 6 years ago

It looks like the data returned from the xmlrpc server is malformed or it's a pypi issue.

try:
    import xmlrpclib
except ImportError:
    import xmlrpc.client as xmlrpclib
import pprint
client = xmlrpclib.ServerProxy('https://pypi.python.org/pypi')
client.search({'name': 'pam'})

Will also raise an exception.

And that's the debug output: (Constucted with client = xmlrpclib.ServerProxy('https://pypi.python.org/pypi', None, None, True))

send: b'POST /pypi HTTP/1.1\r\nHost: pypi.python.org\r\nAccept-Encoding: gzip\r\nContent-Type: text/xml\r\nUser-Agent: Python-xmlrpc/3.6\r\nContent-Length: 224\r\n\r\n'
send: b"<?xml version='1.0'?>\n<methodCall>\n<methodName>search</methodName>\n<params>\n<param>\n<value><struct>\n<member>\n<name>name</name>\n<value><string>pam</string></value>\n</member>\n</struct></value>\n</param>\n</params>\n</methodCall>\n"
reply: 'HTTP/1.1 200 OK\r\n'
header: Content-Encoding header: Content-Security-Policy header: Content-Type header: ETag header: Referrer-Policy header: Server header: Content-Length header: Accept-Ranges header: Date header: Connection header: X-Served-By header: X-Cache header: X-Cache-Hits header: X-Timer header: Vary header: Strict-Transport-Security header: X-Frame-Options header: X-XSS-Protection header: X-Content-Type-Options header: X-Permitted-Cross-Domain-Policies body: b"<?xml version='1.0'?>\n<methodResponse>\n<fault>\n<value><struct>\n<member>\n<name>faultCode</name>\n<value><int>-32500</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>application error</string></value>\n</member>\n</struct></value>\n</fault>\n</methodResponse>\n"
pradyunsg commented 6 years ago

If you think it's a PyPI issue, feel free to file an issue at pypa/warehouse. :)

jhermann commented 6 years ago

The pam package has an empty (null) summary (cf. http --pretty all --follow -v GET https://pypi.org/pypi/pam/json | less -R), which is uncommon and might cause this. And it is definitely server-side, the Fault response is in answer to the XMLRPC request.

In the PyPI server logs, there'll be a line with xml-rpc exception "…", showing the real (internal) exception causing the fault response (the "application" in the error is referring to the XMLRPC server implementation).

pradyunsg commented 6 years ago

Thanks for looking into this @jhermann! I've filed pypa/warehouse#4074 for this.

I'll close this issue. :)

lock[bot] commented 5 years ago

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.