pip not reading the ~/.pip/pip.conf

Question:

This is pertaining to jfrog artifactory. pypi-public is our virtual repo and our internal pypi-internal is associated to pypi-public. I can see the package vapi_common on the web UI.

The below command is able to search the package

pip search vapi_common --index=https://<username>:<apikey>@company.jfrog.io/artifactory/api/pypi/pypi-public/simple

However, if I use the same index-url in ~/.pip/pip.conf

[global]
index-url = https://<username>:<apikey>@company.jfrog.io.jfrog.io/artifactory/api/pypi/pypi-public/simple

and then use the below command
pip search vapi_common -vvv -> fails the below error. As you can see, it is trying to reach pypi.org and is not honoring the index url given in pip.conf

pip search vapi_common -vvv
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "POST /pypi HTTP/1.1" 200 419
ERROR: Exception:
Traceback (most recent call last):
  File "/home/varmour/.pyenv/versions/3.8.8/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 228, in _main
    status = self.run(options, args)
  File "/home/varmour/.pyenv/versions/3.8.8/lib/python3.8/site-packages/pip/_internal/commands/search.py", line 60, in run
    pypi_hits = self.search(query, options)
  File "/home/varmour/.pyenv/versions/3.8.8/lib/python3.8/site-packages/pip/_internal/commands/search.py", line 80, in search
    hits = pypi.search({'name': query, 'summary': query}, 'or')
  File "/home/varmour/.pyenv/versions/3.8.8/lib/python3.8/xmlrpc/client.py", line 1109, in __call__
    return self.__send(self.__name, args)
  File "/home/varmour/.pyenv/versions/3.8.8/lib/python3.8/xmlrpc/client.py", line 1450, in __request
    response = self.__transport.request(
  File "/home/varmour/.pyenv/versions/3.8.8/lib/python3.8/site-packages/pip/_internal/network/xmlrpc.py", line 45, in request
    return self.parse_response(response.raw)
  File "/home/varmour/.pyenv/versions/3.8.8/lib/python3.8/xmlrpc/client.py", line 1341, in parse_response
    return u.close()
  File "/home/varmour/.pyenv/versions/3.8.8/lib/python3.8/xmlrpc/client.py", line 655, in close
    raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault -32500: "RuntimeError: PyPI's XMLRPC API is currently disabled due to unmanageable load and will be deprecated in the near future. See https://status.python.org/ for more information.">
Asked By: Python Beginner

||

Answers:

Please note you yourself use pip search --index=…. That is, you should use option index in pip.conf, not index-url. index is for pip search, index-url is for pip download/install.

See the docs at https://pip.pypa.io/en/stable/reference/pip_search/#options

Fix config:

pip config set global.index https://:@company.jfrog.io.jfrog.io/artifactory/api/pypi/pypi-public/simple

Perhaps even

pip config set global.index `pip config get global.index-url`
Answered By: phd