Skip to content

pip install -U shouldn't go to pypi if the requirement is already installed #770

Closed
mbox opened this Issue Jan 17, 2013 · 4 comments

3 participants

@mbox
mbox commented Jan 17, 2013

Setup a virtualenv with all requirements in pip-reqs.txt installed (requirements that all have a specific version specified)

Running pip install -U and pip install should both be No-ops as nothing needs to be installed.

However the -U version runs about 1000x slower than the straight install:

 pip install -U -r pip-reqs.txt

 real   3m5.072s
 user   0m3.340s
 sys    0m0.970s

 pip install -r ../pip-reqs.txt

 real   0m0.246s
 user   0m0.160s
 sys    0m0.080s

Both runs end up not installing anything - although the -U version does hit two git repos (but it's every single check that's slower, so time isn't accounted for by these pulls)

Environment:

pip 1.2.1 running on Linux

@qwcode
Python Packaging Authority member
qwcode commented Jan 17, 2013

I'm assuming your requirements in pip-reqs.txt have specific versions?
in that case, your complaint is that pip install -U shouldn't be crawling for pypi updates like it's doing, when all it's going to end up doing is accepting the installed versions (because -U does not override requirement specifiers like project==1.1 even if 1.2 is available)
If that's your complaint, I think that's fair, but I'd like to change your title and description.

@mbox
mbox commented Jan 17, 2013

Yes, that's correct - all the packages in the pip-reqs.txt have versions, which are already installed.

So you're right - the bug is that it shouldn't go off to pypi unless the requirement is not already satisfied.

I've changed the title to reflect that.

@mbox
mbox commented Jan 17, 2013

Am I right in thinking the bug is here https://github.com/pypa/pip/blob/develop/pip/req.py#L1072 where if self.upgrade is set, the satisfied_by flag is reset - which presumably causes the update to pull from pypi?

@mbox mbox added a commit to tellybug/pip that referenced this issue Jan 18, 2013
@mbox mbox Fix for #770: pip install -U shouldn't look at pypi if not needed
If an exact version is specified for install, and that version is
already installed, then there is no point going to pypi as no install
is needed.
3785c6c
@msabramo msabramo added a commit to msabramo/pip that referenced this issue Mar 6, 2015
@msabramo msabramo Fix for #770: pip install -U shouldn't look at pypi if not needed
If an exact version is specified for install, and that version is
already installed, then there is no point going to pypi as no install
is needed.

This is a rework of PR #771, because that PR is old and has merge
conflicts that were easier to fix by applying the changes manually.
ed1cbba
@msabramo msabramo added a commit to msabramo/pip that referenced this issue Mar 6, 2015
@msabramo msabramo Fix for #770: pip install -U shouldn't look at pypi if not needed
If an exact version is specified for install, and that version is
already installed, then there is no point going to pypi as no install
is needed.

This is a rework of PR #771, because that PR is old and has merge
conflicts that were easier to fix by applying the changes manually.
c2d5f61
@msabramo msabramo added a commit to msabramo/pip that referenced this issue Mar 6, 2015
@msabramo msabramo Fix for #770: pip install -U shouldn't look at pypi if not needed
If an exact version is specified for install, and that version is
already installed, then there is no point going to pypi as no install
is needed.

Adds a test called
`test_upgrade_no_look_at_pypi_if_exact_version_installed`.

This is a rework of PR #771, because that PR is old and has merge
conflicts that were easier to fix by applying the changes manually.
1da69c8
@msabramo msabramo added a commit to msabramo/pip that referenced this issue Mar 7, 2015
@msabramo msabramo Fix for #770: pip install -U shouldn't look at pypi if not needed
If an exact version is specified for install, and that version is
already installed, then there is no point going to pypi as no install
is needed.

Adds a test called
`test_upgrade_no_look_at_pypi_if_exact_version_installed`.

This is a rework of PR #771, because that PR is old and has merge
conflicts that were easier to fix by applying the changes manually.
d641ee1
@msabramo msabramo added a commit to msabramo/pip that referenced this issue Mar 11, 2015
@msabramo msabramo Fix for #770: pip install -U shouldn't look at pypi if not needed
If an exact version is specified for install, and that version is
already installed, then there is no point going to pypi as no install
is needed.

Adds a test called
`test_upgrade_no_look_at_pypi_if_exact_version_installed`.

This is a rework of PR #771, because that PR is old and has merge
conflicts that were easier to fix by applying the changes manually.
3a2134a
@msabramo msabramo added a commit to msabramo/pip that referenced this issue Mar 12, 2015
@msabramo msabramo Fix for #770: pip install -U shouldn't look at pypi if not needed
If an exact version is specified for install, and that version is
already installed, then there is no point going to pypi as no install
is needed.

Adds a test called
`test_upgrade_no_look_at_pypi_if_exact_version_installed`.

This is a rework of PR #771, because that PR is old and has merge
conflicts that were easier to fix by applying the changes manually.
c185502
@msabramo msabramo added a commit to msabramo/pip that referenced this issue Mar 12, 2015
@msabramo msabramo Fix for #770: pip install -U shouldn't look at pypi if not needed
If an exact version is specified for install, and that version is
already installed, then there is no point going to pypi as no install
is needed.

Adds a test called
`test_upgrade_no_look_at_pypi_if_exact_version_installed`.

This is a rework of PR #771, because that PR is old and has merge
conflicts that were easier to fix by applying the changes manually.
e3aa6f2
@msabramo msabramo added a commit to msabramo/pip that referenced this issue Mar 17, 2015
@msabramo msabramo Fix for #770: pip install -U shouldn't look at pypi if not needed
If an exact version is specified for install, and that version is
already installed, then there is no point going to pypi as no install
is needed.

Adds a test called
`test_upgrade_no_look_at_pypi_if_exact_version_installed`.

This is a rework of PR #771, because that PR is old and has merge
conflicts that were easier to fix by applying the changes manually.
94fcd18
@dstufft
Python Packaging Authority member
dstufft commented Apr 7, 2015

I'm going to close this, we've decided that we're not going to do this. With the new PEP 440 rules the == has slightly different meaning which makes it hard to do this reliably.

@dstufft dstufft closed this Apr 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.