Skip to content

--no-index not respected when --requirement file contains --index-url #11276

@vanschelven

Description

@vanschelven

Description

The behavior of index-url, when used in combination with --no-index, is inconsistent between specifiying it on the command line and in a requirements.txt-like file. Proof:

$ pip install --index-url https://pypi.org/simple --no-index boto3
ERROR: Could not find a version that satisfies the requirement boto3 (from versions: none)
ERROR: No matching distribution found for boto3

$ cat requirements.txt 
--index-url https://pypi.org/simple

$ pip install -i https://pypi.org/simple --no-index -r requirements.txt boto3
Collecting boto3
  Downloading boto3-1.24.33-py3-none-any.whl (132 kB)
     ━━━━━━━━━━━
ERROR: Operation cancelled by user

The same is true for --extra-index-url

Expected behavior

No response

pip version

22.1.2

Python version

3.9

OS

Ubuntu

How to Reproduce

.

Output

No response

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugA confirmed bug or unintended behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions