{"id":"06a7d645c44f6036","repo":"pypa/pip","slug":"xmlrpc-request-failed-code-fault-faultcode-f","errorCode":null,"errorMessage":"XMLRPC request failed [code: {fault.faultCode}]\n{fault.faultString}","messagePattern":"XMLRPC request failed \\[code: (.+?)\\]\n(.+?)","errorType":"exception","errorClass":"CommandError","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/commands/search.py","lineNumber":83,"sourceCode":"        print_results(hits, terminal_width=terminal_width)\n        if pypi_hits:\n            return SUCCESS\n        return NO_MATCHES_FOUND\n\n    def search(self, query: list[str], options: Values) -> list[dict[str, str]]:\n        index_url = options.index\n\n        session = self.get_default_session(options)\n\n        transport = PipXmlrpcTransport(index_url, session)\n        pypi = xmlrpc.client.ServerProxy(index_url, transport)\n        try:\n            hits = pypi.search({\"name\": query, \"summary\": query}, \"or\")\n        except xmlrpc.client.Fault as fault:\n            message = (\n                f\"XMLRPC request failed [code: {fault.faultCode}]\\n{fault.faultString}\"\n            )\n            raise CommandError(message)\n        assert isinstance(hits, list)\n        return hits\n\n\ndef transform_hits(hits: list[dict[str, str]]) -> list[TransformedHit]:\n    \"\"\"\n    The list from pypi is really a list of versions. We want a list of\n    packages with the list of versions stored inline. This converts the\n    list from pypi into one we can use.\n    \"\"\"\n    packages: dict[str, TransformedHit] = OrderedDict()\n    for hit in hits:\n        name = hit[\"name\"]\n        summary = hit[\"summary\"]\n        version = hit[\"version\"]\n\n        if name not in packages.keys():\n            packages[name] = {","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/pypa/pip/blob/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_internal/commands/search.py#L65-L101","documentation":"Raised as CommandError in SearchCommand.search() at search.py:79-83 when the PyPI XMLRPC search call returns an xmlrpc.client.Fault. The fault code and fault string from the server are formatted into the message. Historically this is most common because PyPI deprecated and then disabled its XMLRPC search endpoint.","triggerScenarios":"Running 'pip search <query>' against an index URL (default PyPI) whose XMLRPC search endpoint returns a Fault. The try/except at search.py:77-83 catches xmlrpc.client.Fault raised by pypi.search().","commonSituations":"PyPI permanently disabled the legacy XMLRPC search (HTTP 410 / fault); corporate mirror that does not implement search; network appliance returning an XMLRPC fault; very old pip against a changed server contract.","solutions":["Stop using 'pip search' — PyPI removed the XMLRPC search endpoint; use the PyPI website or a third-party tool instead.","Point --index at a mirror that still supports XMLRPC search, if you have one.","Upgrade pip; modern versions warn that 'pip search' is deprecated/unavailable.","For programmatic queries, use the PyPI JSON API (https://pypi.org/pypi/<project>/json) directly."],"exampleFix":"# before\npip search requests  # XMLRPC disabled on PyPI\n# after — query the JSON API\ncurl -s https://pypi.org/pypi/requests/json | jq '.info.summary'","handlingStrategy":"fallback","validationCode":"# PyPI XMLRPC search is disabled; detect availability before relying on it\nimport urllib.request\ntry:\n    urllib.request.urlopen('https://pypi.org/search/?q=requests', timeout=5)\n    search_available = False  # HTML search exists but XMLRPC does not\nexcept Exception:\n    search_available = False\nprint('pip search via XMLRPC is unavailable; use the web/JSON API')","typeGuard":null,"tryCatchPattern":"import subprocess, xmlrpc.client\ntry:\n    subprocess.run(['pip','search','requests'], check=True)\nexcept subprocess.CalledProcessError:\n    # fallback to the PyPI JSON API\n    import json, urllib.request\n    data = json.load(urllib.request.urlopen('https://pypi.org/pypi/requests/json'))\n    print(data['info']['summary'])","preventionTips":["Migrate off 'pip search' — PyPI permanently disabled the XMLRPC search endpoint.","Use the PyPI JSON API (https://pypi.org/pypi/<project>/json) for programmatic lookups.","Upgrade pip so you get the deprecation notice instead of a raw fault."],"tags":["pip","search","xmlrpc","network","deprecated-api"],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}