Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What is the difference between pip install -Ur and pip install -r?

I’m trying to understand the difference between using pip install -Ur requirements.txt vs pip install -r requirements.txt I noticed that when using the one with -Ur sometimes I get more recent updated packages when compared to using -r. I tried to look it up across the internet but didn’t find a reasonable explanation. Can anyone please explain the difference?

Thanks!

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

pip’s official documentation says:

-U, --upgrade

Upgrade all specified packages to the newest available version. The handling of dependencies depends on the upgrade-strategy used.

So the difference is that pip install -r only installs dependencies, while -Ur also upgrades dependencies, if there is a new version available.

There’s also another reference that says:

Once you’ve got your requirements file, you can head over to a different computer or new virtual environment and run the following:

pip install -r requirements.txt

[…]
This tells pip to install the specific versions of all the dependencies listed.

To upgrade your installed packages, run the following:

pip install --upgrade -r requirements.txt

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading