Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pip search fails with private index url #6884

Closed
j-bennet opened this issue Aug 15, 2019 · 3 comments
Closed

Pip search fails with private index url #6884

j-bennet opened this issue Aug 15, 2019 · 3 comments
Labels
auto-locked Outdated issues that have been locked by automation C: search 'pip search' type: support User Support

Comments

@j-bennet
Copy link

j-bennet commented Aug 15, 2019

Environment

  • pip version: 19.2.2
  • Python version: 3.6.5
  • OS: macOS Mojave

Description

I am searching for a package in custom repository. The repository is hosted with SSL and protected by basic auth. pip search command fails with 403 Client Error as follows:

--- ~ » pip search -i "https://user:[email protected]/cogtree/" -vvv engicore
Found credentials in url for pypi.cogtree.com
Starting new HTTPS connection (1): pypi.cogtree.com:443
https://pypi.cogtree.com:443 "POST /cogtree/ HTTP/1.1" 403 162
ERROR: HTTP error 403 while getting https://user:[email protected]/cogtree/
ERROR: Exception:
Traceback (most recent call last):
  File "/Users/irina/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 188, in main
    status = self.run(options, args)
  File "/Users/irina/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pip/_internal/commands/search.py", line 48, in run
    pypi_hits = self.search(query, options)
  File "/Users/irina/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pip/_internal/commands/search.py", line 65, in search
    hits = pypi.search({'name': query, 'summary': query}, 'or')
  File "/Users/irina/.pyenv/versions/3.6.5/lib/python3.6/xmlrpc/client.py", line 1112, in __call__
    return self.__send(self.__name, args)
  File "/Users/irina/.pyenv/versions/3.6.5/lib/python3.6/xmlrpc/client.py", line 1452, in __request
    verbose=self.__verbose
  File "/Users/irina/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pip/_internal/download.py", line 1010, in request
    response.raise_for_status()
  File "/Users/irina/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pip/_vendor/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
pip._vendor.requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://pypi.cogtree.com/cogtree/

I also tried adding simple to the URL, which gives me a 405:

--- ~ » pip search -i "https://user:[email protected]/cogtree/simple/" -vvv engicore                                                                                                                                                  2 ↵
Found credentials in url for pypi.cogtree.com
Starting new HTTPS connection (1): pypi.cogtree.com:443
https://pypi.cogtree.com:443 "POST /cogtree/simple/ HTTP/1.1" 405 166
ERROR: HTTP error 405 while getting https://user:[email protected]/cogtree/simple/
ERROR: Exception:
Traceback (most recent call last):
  File "/Users/irina/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 188, in main
    status = self.run(options, args)
  File "/Users/irina/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pip/_internal/commands/search.py", line 48, in run
    pypi_hits = self.search(query, options)
  File "/Users/irina/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pip/_internal/commands/search.py", line 65, in search
    hits = pypi.search({'name': query, 'summary': query}, 'or')
  File "/Users/irina/.pyenv/versions/3.6.5/lib/python3.6/xmlrpc/client.py", line 1112, in __call__
    return self.__send(self.__name, args)
  File "/Users/irina/.pyenv/versions/3.6.5/lib/python3.6/xmlrpc/client.py", line 1452, in __request
    verbose=self.__verbose
  File "/Users/irina/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pip/_internal/download.py", line 1010, in request
    response.raise_for_status()
  File "/Users/irina/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pip/_vendor/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
pip._vendor.requests.exceptions.HTTPError: 405 Client Error: Not Allowed for url: https://pypi.cogtree.com/cogtree/simple/

Expected behavior

pip search to not fail.

I am able to browse the repository using the web browser. This also returns a valid response:

--- ~ » ipython
In [1]: import requests

In [2]: requests.get('https://user:[email protected]/cogtree/')
Out[2]: <Response [200]>
@triage-new-issues triage-new-issues bot added the S: needs triage Issues/PRs that need to be triaged label Aug 15, 2019
@uranusjr
Copy link
Member

uranusjr commented Aug 16, 2019

The search command uses a non-standard XML-RPC API (see #395). cogtree.com (I don’t know anything about this website) likely does not have it implemented.

@xavfernandez xavfernandez added C: search 'pip search' type: support User Support labels Sep 2, 2019
@triage-new-issues triage-new-issues bot removed the S: needs triage Issues/PRs that need to be triaged label Sep 2, 2019
@xavfernandez
Copy link
Member

Hello, we'd need to know what software is behind pypi.cogtree.com (devpi, etc) to help.

But as @uranusjr said, pip search uses a specific endpoint, usually different than /simple.
For instance for pypi.org: pip install uses https://pypi.org/simple/ but pip search uses https://pypi.org/pypi/.

@xavfernandez xavfernandez added the S: awaiting response Waiting for a response/more information label Sep 2, 2019
@j-bennet
Copy link
Author

j-bennet commented Sep 2, 2019

Yes, apparently pypi.cogtree.com is a simple mirror created with pip2pi:

https://github.com/dan-blanchard/pip2pi

It would not have the endpoint pip search is looking for.

I'm closing the issue.

@j-bennet j-bennet closed this as completed Sep 2, 2019
@no-response no-response bot removed the S: awaiting response Waiting for a response/more information label Sep 2, 2019
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Oct 2, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation C: search 'pip search' type: support User Support
Projects
None yet
Development

No branches or pull requests

3 participants