3

I know I can use

pip --ignore-installed --no-deps

to reinstall a pkg without dependencies; however, if a dependency is missing, it won't get installed anyway. How can I reinstall a pkg and only dependencies that are not installed, but ignore dependencies that have been already installed?

zx_wing
  • 1,918
  • 3
  • 26
  • 39
  • 3
    With a normal `pip install`, if any dependencies are already installed, pip will notice that and not install them again. – BrenBarn Feb 02 '15 at 04:48
  • @BrenBarn but pip install cannot reinstall a pkg – zx_wing Feb 02 '15 at 04:49
  • Does [this answer](http://stackoverflow.com/a/27254355/1427416) do what you want? – BrenBarn Feb 02 '15 at 04:51
  • @BrenBarn No. Once --no-deps is specified, the missing dependencies will not be installed as well. – zx_wing Feb 02 '15 at 04:55
  • I see. So you are asking "how do I force reinstall of just this package, and install dependencies that are not installed, but not reinstall or modify any that are already installed"? If so, I think you should edit your question to say that explicitly. It is not clear from the way you have phrased it currently. – BrenBarn Feb 02 '15 at 05:04
  • @BrenBarn updated it – zx_wing Feb 02 '15 at 05:09
  • I think the idea of "reinstall" is somewhat incompatible with the idea of installing missing dependencies. "Reinstall" means it's already installed; if some of the dependencies aren't installed, then the package isn't really fully installed. – BrenBarn Feb 02 '15 at 05:14

1 Answers1

0

Just for people who stumble across this question later -- If I understand your question correctly, this functionality was added a while ago. I would have to look up when it made it into pip. The upgrade strategy 'only-if-needed' is the current default so that could be left out BUT, as a pythonista, explicit is better than implicit :)

pip install --upgrade --upgrade-strategy only-if-needed <package-name>

Essentially, what this is doing is upgrading the package and it will reinstall dependencies if needed. this will only install missing or outdated dependencies. It will not upgrade dependencies that already satisfy the package requirements even if there is a newer version that also satisfies the package requirments.

You can read more about this functionality in the pip documentation

mcfarke311
  • 81
  • 1
  • 5