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

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
Closed
Labels
auto-locked Outdated issues that have been locked by automation

Comments

@mbox
Copy link

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
Copy link
Contributor

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
Copy link
Author

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
Copy link
Author

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 added a commit to tellybug/pip that referenced this issue Jan 18, 2013
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.
msabramo added a commit to msabramo/pip that referenced this issue Mar 17, 2015
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 pypa#771, because that PR is old and has merge
conflicts that were easier to fix by applying the changes manually.
dstufft added a commit that referenced this issue Mar 17, 2015
Fix for #770: pip install -U shouldn't look at pypi if not needed
@dstufft
Copy link
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 as completed Apr 7, 2015
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 5, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

No branches or pull requests

3 participants