PBR

pip only respects 1 version specifier for any particular name

Bug #1446425 reported by James Polley
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PBR
Invalid
Undecided
Unassigned

Bug Description

... and a top-level name in requirements.txt will be preferred over one inside install_requires.

The practical implication of this is that if requirements.txt specifies "bar>=2.0" and "foo", and "foo" install_requires "bar>=2.1", "pip install -r requirements.txt" will not upgrade an already-installed "bar==2.0", while "pip install foo" will.

attachment repro.tar.gz has a small virtualenv skeleton that can be used to demonstrate this.

Create and activate a virtualenv, unpack repro.tar.gz inside; you should have a requirements.txt and directory called index/ containing two versions of bar and one version of foo.

First, install bar==2.0:

    pip install -f index/ bar==2.0

Now install from requirements.txt:

    pip install -f index/ -r requirements

You should see that foo is upgraded, but bar is not:

    Successfully installed foo-0.3

Reset the environment: pip uninstall foo

Now install the package directly:

    pip install -f index/ foo

You should see that foo is installed and bar upgraded:

    Successfully installed bar-2.1 foo-0.3

Revision history for this message
James Polley (tchaypo) wrote :
summary: - pip only respects 1 version specififier for any particular name
+ pip only respects 1 version specifier for any particular name
Revision history for this message
Robert Collins (lifeless) wrote :

Ok, so this is just pip issue 988 I believe.

First encountered requirement is honoured, rest error or are ignored.

Revision history for this message
James Polley (tchaypo) wrote :

Yes, I believe that what I've demonstrated is pip issue 988 - specifically case 1(b) from that bug (top-level requirements override dependencies)

The reason it's filed here is because of a belief that pbr causes pip to do something different.

Revision history for this message
Robert Collins (lifeless) wrote :

I don't see how its different. You've supplied a top level constraint as in - 1b

lets work through this:

>First, install bar==2.0:
> pip install -f index/ bar==2.0

trivial

>Now install from requirements.txt:
> pip install -f index/ -r requirements

This is precisely equivalent to pip install -f index foo bar>=2.0
Stage 0 reqs are foo, bar>=2.0
when foo is examined 0.3 is found, giving us a selection of foo=0.3. foo's dependency of bar >=2.1 is ignored, because 1b - bar>=2.0 is already the constraint and the new constraint is ignored.

> You should see that foo is upgraded, but bar is not:
> Successfully installed foo-0.3

trivial

> Reset the environment: pip uninstall foo
> Now install the package directly:
> pip install -f index/ foo

The top level constraint here is foo, bar is not a constraint.
Now the bar constraint from foo is added, and evaluated against the environment, resulting in a mandatory upgrade from 2.0.

Revision history for this message
Robert Collins (lifeless) wrote :

closing, redundant with pip 988.

Changed in pbr:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.