How to update all but one python packages?
Question:
I’ve multiple python packages installed on my system. My update script calls pip-review --local --auto
to update all the python packages. However, I don’t want to update all packages. What I want is pip-review
to update all packages except scons
, since one of my programs needs an older version of scons
. Currently to do this, I run pip-review --local --auto && python3 pip uninstall -y scons && python3 -m pip install -Iv scons==3.1.2
which updates all packages and then uninstalls the new version of scons
and then re-installs it with a specific version number. Is there a nicer way to do this?
Answers:
pip install -r $(grep -v '^ *#|^pkg1|^pkg2' requirements.txt | grep .)
This is a shell hack to exclude pkg1, pkg2, etc. from a pip install using requirements.txt, but you may want to modify it and see if it suits your purpose. But like the other guy said, use a virtualenv going forward.
Based on the comments and answers posted by other users, I’ve decided to go for the following piece of command to update all packages except scons:
pip-review --local --auto && python3 -m pip install -U scons==3.1.2
Thanks a lot to everyone for helping me out with this.
I’ve multiple python packages installed on my system. My update script calls pip-review --local --auto
to update all the python packages. However, I don’t want to update all packages. What I want is pip-review
to update all packages except scons
, since one of my programs needs an older version of scons
. Currently to do this, I run pip-review --local --auto && python3 pip uninstall -y scons && python3 -m pip install -Iv scons==3.1.2
which updates all packages and then uninstalls the new version of scons
and then re-installs it with a specific version number. Is there a nicer way to do this?
pip install -r $(grep -v '^ *#|^pkg1|^pkg2' requirements.txt | grep .)
This is a shell hack to exclude pkg1, pkg2, etc. from a pip install using requirements.txt, but you may want to modify it and see if it suits your purpose. But like the other guy said, use a virtualenv going forward.
Based on the comments and answers posted by other users, I’ve decided to go for the following piece of command to update all packages except scons:
pip-review --local --auto && python3 -m pip install -U scons==3.1.2
Thanks a lot to everyone for helping me out with this.