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

Feature request: flag to unset --extra-index-url #6394

Open
bennuttall opened this issue Apr 9, 2019 · 5 comments
Open

Feature request: flag to unset --extra-index-url #6394

bennuttall opened this issue Apr 9, 2019 · 5 comments
Labels
C: finder PackageFinder and index related code type: feature request Request for a new feature

Comments

@bennuttall
Copy link

What's the problem this feature will solve?

If extra-index-url is set in /etc/pip.conf or equivalent, it's not possible (as far as I'm aware) to unset this option in a pip command. You can replace --index-url but not unset --extra-index-url. If you have a third-party source set as an additional index, but want to explicitly install from PyPI, you have to clear /etc/pip.conf.

Describe the solution you'd like

Either a new flag to disable extra-index-url, or a new flag to specify to explicitly use one index, e.g:

$ pip install package --no-extra-index
$ pip install package --only-use-index-url https://pypi.org/simple

Alternative Solutions

As far as I'm aware, the only alternative is to delete /etc/pip.conf, and there's no way to tell pip not to use it for a particular use.

Additional context

I maintain a third-party repo at piwheels.org for Raspberry Pi users and we pre-configure /etc/pip.conf in Raspbian to set extra-index-url. If users want to make sure their installation comes from PyPI one time, they have to remove /etc/pip.conf.

One such reason for this is when a package's requirements.txt specifies hashes from PyPI, e.g. piwheels/piwheels#144

@chrahunt
Copy link
Member

May be related to #4263, which tries to solve this kind of issue in a general way. An extension to that proposal could take this use case into account without creating more command-line options.

Could also be related to #6131, which suggests that an empty value for --index-url should take on the default. Extending that to --extra-index-url may be reasonable.

@chrahunt chrahunt added C: finder PackageFinder and index related code type: feature request Request for a new feature labels Jul 20, 2019
@triage-new-issues triage-new-issues bot removed the S: needs triage Issues/PRs that need to be triaged label Jul 20, 2019
@Helveg
Copy link

Helveg commented Oct 30, 2019

This would also be useful when you have a private package repository that is only available on some networks. I'm now faced with the issue that every package I want to install it first has to time out after 4 times 15 seconds before it looks on the PyPI. Pic related
image

@qrnik
Copy link

qrnik commented Feb 12, 2021

I believe this should be prioritised as a security issue. Lack of ability to force certain index in pip install command poses security risk of installing unwanted (and potentially malicious) public package in case of primary index is down or has older version of the package. This article perfectly highlights the hazard: https://medium.com/@alex.birsan/dependency-confusion-4a5d60fec610

@stefansjs
Copy link

similarly for --trusted-host

@bcm-at-zama
Copy link

I have had this issue and I used

  --isolated                  Run pip in an isolated mode, ignoring environment variables and user configuration.

option, which was able to solve my issue. Maybe it will be useful to others?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: finder PackageFinder and index related code type: feature request Request for a new feature
Projects
None yet
Development

No branches or pull requests

7 participants