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

[10.0.0beta] Installation emits extra warnings for unrelated packages #5196

Closed
di opened this issue Apr 9, 2018 · 23 comments · Fixed by #5457
Closed

[10.0.0beta] Installation emits extra warnings for unrelated packages #5196

di opened this issue Apr 9, 2018 · 23 comments · Fixed by #5457
Assignees
Labels
auto-locked Outdated issues that have been locked by automation type: bug A confirmed bug or unintended behavior
Milestone

Comments

@di
Copy link
Member

di commented Apr 9, 2018

  • Pip version: 516adb4 (current release/10.0.0 HEAD)
  • Python version: 3.6.4
  • Operating system: Darwin 17.5.0 x86_64 i386

Description:

Running pip install <package> will emit warnings about missing dependencies for unrelated packages (essentially, the output of pip check). I would expect to see warnings only related to the package I'm attempting to install.

This seems similar to some fixed issues (#5134, #5160, #5195) but still occurs after the fixes for those issues.

What I've run:

The actual packages used don't matter: when a package A has unmet dependency B, installing C (with no shared dependencies with A) will warn that B is missing.

$ pip install freezegun
Collecting freezegun
  Using cached freezegun-0.3.10-py2.py3-none-any.whl
Collecting six (from freezegun)
  Using cached six-1.11.0-py2.py3-none-any.whl
Collecting python-dateutil!=2.0,>=1.0 (from freezegun)
  Using cached python_dateutil-2.7.2-py2.py3-none-any.whl
Installing collected packages: six, python-dateutil, freezegun
Successfully installed freezegun-0.3.10 python-dateutil-2.7.2 six-1.11.0

$ pip uninstall six
Uninstalling six-1.11.0:
  Would remove:
    /private/tmp/env/lib/python3.6/site-packages/six-1.11.0.dist-info/*
    /private/tmp/env/lib/python3.6/site-packages/six.py
Proceed (y/n)? y
  Successfully uninstalled six-1.11.0

$ pip install black
Collecting black
  Using cached black-18.4a0-py36-none-any.whl
Collecting attrs>=17.4.0 (from black)
  Using cached attrs-17.4.0-py2.py3-none-any.whl
Collecting click (from black)
  Using cached click-6.7-py2.py3-none-any.whl
python-dateutil 2.7.2 requires six>=1.5, which is not installed. <============== I don't expect to see this line
freezegun 0.3.10 requires six, which is not installed.           <============== I don't expect to see this line
Installing collected packages: attrs, click, black
Successfully installed attrs-17.4.0 black-18.4a0 click-6.7
@cjerdonek
Copy link
Member

Does this occur with 9.x, too?

@pradyunsg
Copy link
Member

Hey @di!

This is intentional - to cover a user with an already broken environment, by telling them that they have a broken dependency if the operation they perform doesn't fix it.

I'm curious, is there some reason that you don't want to know that there's a broken dependency?

@cjerdonek This is new behaviour in pip 10. #5000

@di
Copy link
Member Author

di commented Apr 10, 2018

@pradyunsg I guess I was just surprised by it since it's new. This warning made me think that something went wrong with the command I had run, when in fact I had just botched up my environment days ago, and was just seeing the results much later.

Fine with me if this was planned all along and should be closed, I just think it's probably going to catch a lot of people off guard when they see it for the first time.

@cjerdonek
Copy link
Member

cjerdonek commented Apr 10, 2018 via email

@pfmoore
Copy link
Member

pfmoore commented Apr 10, 2018

Until this issue came up, I never really considered the possibility of unrelated incompatibilities being flagged when something was installed. I doubt it's a particularly common situation - once your environment has no broken dependencies, anything new that gets flagged will be because of what you've just installed - but I agree the message is a little surprising if it's reporting an existing issue.

I don't think it's a major issue, personally - and in the long run we'll be getting a proper resolver which will avoid such broken dependencies in the first place - so I don't think it needs to be a release blocker. If someone wants to submit a PR fixing this for pip 10.1, I'd be fine with that.

@di
Copy link
Member Author

di commented Apr 10, 2018

I will agree that my various environments are probably uncommon -- I usually have a few unmet or broken dependencies. 🙂

Even with a proper resolver, though, won't this still be possible to reproduce? In the example above, what would change? Would pip uninstall refuse to uninstall the dependency without installing what depends on it? Or would it just uninstall everything that depends on it? Or would it work just like it does now?

@pfmoore
Copy link
Member

pfmoore commented Apr 10, 2018

I've added an issue against the resolver project to consider how to handle that gracefully. You're right that people can have unmet or broken dependencies. My assumption is that when they do, it's because they didn't realise it, and they would fix it once informed. And in the context of a full resolver, pip itself would in effect make sure that once an environment is "good", it will stay that way But there's certainly a usability question over how pip install foo with a full resolver should should handle such broken environments when first encountered - "helpfully" tidying up unrelated issues is a bit presumptuous, but conversely, not doing so means that we can't state unequivocally that pip won't leave you with a broken environment.

Going back to the current situation, I guess a key question is - when you saw those warnings (not in your test case, but in your actual environment), were you motivated to fix them, or did you want to leave things as they were? And if the latter, was that because you didn't believe the warnings mattered ("I'm sure it will work anyway") or something else (I find it hard to think of another reason you'd want to leave your environment broken, apart from "I don't want to deal with this now" - but that's fine, you're motivated to fix them, but we're not forcing you to do so immediately).

@di
Copy link
Member Author

di commented Apr 10, 2018

Well, I wasn't exactly in prod, so once I got past "Huh, why didn't that work" and "Wait, why does X even depend on Y?", I didn't care, but mostly because it was just a one-off environment that I was doing some testing in.

If it had been a more important environment I might have cared, but usually I'm either a) not pip installing willy nilly in said environments, or b) not actually looking at the output of pip install unless it has failed with an exit code. So I think this warning is either going to confuse me unnecessarily or just never get noticed, but again, I realize that I might not be the typical user.

@pfmoore
Copy link
Member

pfmoore commented Apr 10, 2018

Thanks for the feedback - it's definitely something we should monitor in real use, so it's good to get people's reactions. (And personally, I'm not that convinced you're particularly atypical - I suspect my reaction would be similar).

@cjerdonek
Copy link
Member

cjerdonek commented Apr 10, 2018 via email

@jackton1

This comment has been minimized.

@ben-albrecht
Copy link

ben-albrecht commented Apr 18, 2018

This is intentional - to cover a user with an already broken environment, by telling them that they have a broken dependency if the operation they perform doesn't fix it.

I'm curious, is there some reason that you don't want to know that there's a broken dependency?

As another use-case, our project builds packages in a local virtualenv as part of the installation. During the build, users will get warnings about broken package dependencies in their pip environment, which is irrelevant to the local virtualenv build that is taking place and creates confusion as to whether the warnings are related to installing the software or not.

I agree that these warnings are generally helpful, but it would be nice to have a way to suppress them for specific use-cases (I could not find a flag in the help output, if it already exists).

@pradyunsg
Copy link
Member

pradyunsg commented Apr 28, 2018 via email

@di
Copy link
Member Author

di commented Apr 28, 2018

Would a separate option to specify packages to ignore (when they occurs as dependencies) would be useful?

Personally I don't think so. This issue is more about avoiding initial confusion than dealing w/ an annoying warning. Being able to explicitly ignore warnings for some set of packages doesn't really help with that first case.

@pradyunsg
Copy link
Member

So... Any actionable ideas here?

@pradyunsg pradyunsg added type: enhancement Improvements to functionality state: needs discussion This needs some more discussion S: needs triage Issues/PRs that need to be triaged labels May 10, 2018
@ben-albrecht
Copy link

Would a separate option to specify packages to ignore (when they occurs as
dependencies) would be useful?

For the use-case I described above, a flag for ignoring this warning altogether (rather than a package-specific warning) would suffice as a solution.

@pradyunsg
Copy link
Member

For the use-case I described above, a flag for ignoring this warning altogether (rather than a package-specific warning) would suffice as a solution.

We have --no-warn-conflicts.

@di
Copy link
Member Author

di commented May 10, 2018

I think one actionable idea is what @cjerdonek mentions here:

My 2 cents: I don’t think “pip install foo” should report errors about dependencies not in foo’s dependency graph

I'm not familiar enough with pip to be able to say how actionable that is, but I think that this would resolve the original issue, at least for me.

@ben-albrecht
Copy link

We have --no-warn-conflicts

@pradyunsg - I was not aware of this. This is acceptable for my specific use-case. Thanks!

@pradyunsg
Copy link
Member

My 2 cents: I don’t think “pip install foo” should report errors about dependencies not in foo’s dependency graph

I'm not familiar enough with pip to be able to say how actionable that is, but I think that this would resolve the original issue, at least for me.

Indeed. I'll explore this avenue.

@pradyunsg pradyunsg removed the state: needs discussion This needs some more discussion label May 11, 2018
@pradyunsg pradyunsg self-assigned this May 11, 2018
@mitsuhiko
Copy link
Contributor

It also brings up the warning for packages found by an egg info not yet installed. In particular it also warns about things required for setup (setup_required) and it warns for any system python 2.7 on mac because of global missing dependencies of matplotlib.

@pradyunsg pradyunsg removed the S: needs triage Issues/PRs that need to be triaged label May 30, 2018
@pradyunsg pradyunsg added this to the 18.0 milestone May 30, 2018
@pradyunsg pradyunsg added type: bug A confirmed bug or unintended behavior and removed type: enhancement Improvements to functionality labels May 30, 2018
@pradyunsg
Copy link
Member

pradyunsg commented May 30, 2018

Made a PR: #5457. If someone could take it for a spin and provide feedback, that'd be awesome. :)

@lock
Copy link

lock bot commented Jun 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 2, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 2, 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 type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants