Pip search --index 'https://user:pass@localserver:8443/repository/pypi/' mypip broken

Hello,

I managed to setup an internal PIP repository and I can upload artifacts using twine (different user). But for some reason I cannot do a search on the command line:

pip search --index 'https://user:pass@localserver:8443/repository/pypi/' mypip

Because I get the following error:

ERROR: HTTP error 403 while getting https://user:pass@machine.company.com:8443/repository/pypi/
ERROR: Exception:
Traceback (most recent call last):
  File "/home/localuser/virtualenv/avt/lib64/python3.7/site-packages/pip/_internal/cli/base_command.py", line 188, in _main
    status = self.run(options, args)
  File "/home/localuser/virtualenv/avt/lib64/python3.7/site-packages/pip/_internal/commands/search.py", line 52, in run
    pypi_hits = self.search(query, options)
  File "/home/localuser/virtualenv/avt/lib64/python3.7/site-packages/pip/_internal/commands/search.py", line 71, in search
    hits = pypi.search({'name': query, 'summary': query}, 'or')
  File "/usr/lib64/python3.7/xmlrpc/client.py", line 1112, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python3.7/xmlrpc/client.py", line 1452, in __request
    verbose=self.__verbose
  File "/home/localuser/virtualenv/avt/lib64/python3.7/site-packages/pip/_internal/network/xmlrpc.py", line 36, in request
    response.raise_for_status()
  File "/home/localuser/virtualenv/avt/lib64/python3.7/site-packages/pip/_vendor/requests/models.py", line 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
pip._vendor.requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://machine.company.com:8443/repository/pypi/

I granted read and browse permissions on a role for this user, there is anything else I need to do to allow the search to work?
Also how I can troubleshoot myself this issue? I was looking on the logs but I do not see Nexus 3 complaining (I’m using pip 20.1.1 from Python 2,7 on Linux)

Thanks,

–Jose

The index URL needs to have “/index” appended to it.

https://user:pass@localserver:8443/repository/pypi/index

Can you try using that?

It works if I use the browser:

But on the command line it fails with the same error:
pip search --index ‘https://YYYY:ZZZZ@mypipserver.com:8443/repository/XXXX-pypi/index’ mypip
ERROR: Exception:
Traceback (most recent call last):
File “/home/QQQQQQQ/virtualenv/MyvirtualEnv/lib64/python3.7/site-packages/pip/_internal/network/xmlrpc.py”, line 43, in request
raise_for_status(response)
File “/home/QQQQQQQ/virtualenv/MyvirtualEnv/lib64/python3.7/site-packages/pip/_internal/network/utils.py”, line 55, in raise_for_status
raise NetworkConnectionError(http_error_msg, response=resp)
pip._internal.exceptions.NetworkConnectionError: 404 Client Error: Not Found for url: https://myserver.com:8443/repository/XXXX-pypi/index

The following URL did the trick for me:
pip search --index ‘https://user:pass@localserver:8443/repository/pypi/pypi’ mypip