You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running pip install with both the --ignore-installed and --force-reinstall flags, --force-reinstall is effectively disabled by --ignore-installed. It's not entirely intuitive that these options are in conflict and that ignore-installed has priority.
Here's my understanding of what happens. The force-reinstall option only takes effect if the package being installed is returned by the get_dist_to_uninstall function:
This prevents force-reinstall from having any effect.
Describe the solution you'd like
This behavior seems to mean that there's never any situation in which you'd want to (or be able to) use --ignore-installed and --force-reinstall at the same time. Given this, can pip throw an error if both flags are used? Explicitly failing with instructions to choose one seems better than silently disabling force-reinstall.
Say you're trying to resolve some mysterious dependency problems. You're using the force-reinstall option, but you're still having issues, so you look at the available pip install options and see ignore-installed. You might try that too, thinking that the effect will be additive, but this silently disables force-reinstall instead, sending you on a wild goose chase.
Alternative Solutions
A warning could be printed when using both flags, instead of throwing an error. The ignore-installed help text could also be updated to inform users that it shouldn't be used with the force-reinstall option.
I think throwing an error would be better since this seems like a fundamentally invalid combination of options, but warning messages or usage instructions would be less intrusive.
The text was updated successfully, but these errors were encountered:
What's the problem this feature will solve?
When running
pip install
with both the--ignore-installed
and--force-reinstall
flags,--force-reinstall
is effectively disabled by--ignore-installed
. It's not entirely intuitive that these options are in conflict and thatignore-installed
has priority.Here's my understanding of what happens. The
force-reinstall
option only takes effect if the package being installed is returned by theget_dist_to_uninstall
function:pip/src/pip/_internal/resolution/resolvelib/resolver.py
Lines 135 to 143 in 89d50dd
get_dist_to_uninstall
checks the_installed_dists
dict to see if the package is already installed:pip/src/pip/_internal/resolution/resolvelib/factory.py
Lines 323 to 328 in 89d50dd
Before any of this happened, though,
_installed_dists
was set to an empty dict by theignore-installed
option:pip/src/pip/_internal/resolution/resolvelib/factory.py
Lines 102 to 108 in 89d50dd
This prevents
force-reinstall
from having any effect.Describe the solution you'd like
This behavior seems to mean that there's never any situation in which you'd want to (or be able to) use
--ignore-installed
and--force-reinstall
at the same time. Given this, can pip throw an error if both flags are used? Explicitly failing with instructions to choose one seems better than silently disablingforce-reinstall
.Say you're trying to resolve some mysterious dependency problems. You're using the
force-reinstall
option, but you're still having issues, so you look at the availablepip install
options and seeignore-installed
. You might try that too, thinking that the effect will be additive, but this silently disablesforce-reinstall
instead, sending you on a wild goose chase.Alternative Solutions
A warning could be printed when using both flags, instead of throwing an error. The
ignore-installed
help text could also be updated to inform users that it shouldn't be used with theforce-reinstall
option.I think throwing an error would be better since this seems like a fundamentally invalid combination of options, but warning messages or usage instructions would be less intrusive.
The text was updated successfully, but these errors were encountered: