Skip to content

Conflict between constraint in requirements.txt and separate constraints file raises unhelpful error #9448

@stephenfin

Description

@stephenfin

What did you want to do?

Consider the following requirements.txt and constraints.txt files:

$ cat requirements.txt 
requests>=2.20.0,<2.25.0
$ cat constraints.txt 
requests==2.25.0

You'll note that I'm saying the upper cap should be <2.25.0 in requirements.txt and that it should be ==2.25.0 in constraints.txt. This fails, which does seem reasonable given this is most likely a bug/misconfiguration. However, the error message is not clear and enabling verbose mode doesn't provide any further hints. When there are many requirements and constraints, it can be difficult to identify the root cause.

Output

$ pip install -c constraints.txt -r requirements.txt 
ERROR: Could not find a version that satisfies the requirement requests<2.25.0,>=2.20.0
ERROR: No matching distribution found for requests<2.25.0,>=2.20.0

I expected either the command to fail with a more helpful error message (e.g. There are conflicting constraints for the requirement requests) or for pip to configure the allowed range of requirements to the minimal combined range of all requirements and constraints files.

Additional information

I also tried this using the current master commit. Same issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions