Skip to content

index-url option doesn't work with pip search #2170

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

Closed
orodbhen opened this issue Dec 11, 2014 · 7 comments
Closed

index-url option doesn't work with pip search #2170

orodbhen opened this issue Dec 11, 2014 · 7 comments
Labels
auto-locked Outdated issues that have been locked by automation

Comments

@orodbhen
Copy link

I have a package index setup on a LAN with no connection to the internet. I have index-url set to point to our index. Almost everything works well, except pip search always throws a ConnectionError.

Are there plans to support index-url for all pip commands. I'm curious as to why it would work with install, but not search.

@dstufft
Copy link
Member

dstufft commented Dec 11, 2014

Try it with the develop version, I believe it works there.

@orodbhen
Copy link
Author

I still get the ConnectionError. It seems that the url is hard-coded in commands/search.py:

class SearchCommand(Command):                                                                          
    """Search for PyPI packages whose name or summary contains <query>."""                             
    name = 'search'                                                                                    
    usage = """                                                                                        
    %prog [options] <query>"""                                                                       
    summary = 'Search PyPI for packages.'                                                              

    def __init__(self, *args, **kw):                                                                   
        super(SearchCommand, self).__init__(*args, **kw)                                               
        self.cmd_opts.add_option(                                                                      
            '--index',                                                                                 
            dest='index',                                                                              
            metavar='URL',                                                                             
            default='https://pypi.python.org/pypi',                                                    
            help='Base URL of Python Package Index (default %default)')                                

        self.parser.insert_option_group(0, self.cmd_opts)

I tried hard-coding a new url, but I'm using a local file:// cache, and the logic doesn't support that protocol.

@orodbhen
Copy link
Author

Correction: It's not hard-coded. I can pass it the path using the --index option, but I get:

IOError: unsupported XML-RPC protocol

I can also set "index=" in pip.conf, but I get the same message. Is there a reason it uses "index" instead of "index-url"?

@dstufft
Copy link
Member

dstufft commented Dec 11, 2014

The fact that it uses --index instead of --index-url is probably just an oversight.

The reason you get that error is the search command uses PyPI's XMLRPC api and your index doesn't support that.

@orodbhen
Copy link
Author

Is there any interest in supporting the Simple API? I suppose the lack of meta-data makes it pretty limited, but it can at least return name and version.

@xavfernandez
Copy link
Member

This looks like a duplicate of #589

@xavfernandez
Copy link
Member

Closing as duplicate

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 4, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 4, 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
Projects
None yet
Development

No branches or pull requests

3 participants