Updating by pip install
I wonder, why simple
$ pip install -r requirements.txt --upgrade
would not be enough?
It does compare current virtualenv with your requirements and does only the updates, which are necessary.
Removing unwanted packages
Regarding removing unwanted packages - is that really necessary? If you really insist on it, I would create unwanted-requirements.txt
and before updating packages by previous call I would perform:
$ pip uninstall -r unwanted-requirements.txt
followed by $ pip install ...`
If you keep your system as consistent as you think, this shall be working quite well and in case you would make a mistake in unwanted-requirements.txt
, your system is quite likely to survive as unused package is in most situations not harmful and having removed wanted package shall recover by subsequent $ pip install ...
Speeding up installations
If your real concern is not only having consistent installations, but also have them updated quickly, than there are well working methods how to speed things up. See my SO answer https://stackoverflow.com/a/18520729/346478