abhiomkar abhiomkar - 1 year ago 115
Python Question

Upgrade python packages from requirements.txt using pip command

How do I upgrade all my python packages from requirements.txt file using pip command?

tried with below command

$ pip install --upgrade -r requirements.txt

Since, the python packages are suffixed with the version number (
) they don't seem to upgrade. Is there any better approach than manually editing requirements.txt file?


As Andy mentioned in his answer packages are pinned to a specific version, hence it is not possible to upgrade packages through pip command.

But, we can achieve this with
using the following command.

$ pip-review --auto

this will automatically upgrade all packages from requirements.txt (make sure to install
using pip install command).

Answer Source

No. Your requirements file has been pinned to specific versions. If your requirements are set to that version, you should not be trying to upgrade beyond those versions. If you need to upgrade, then you need to switch to unpinned versions in your requirements file.



This would upgrade lxml to any version newer than 2.2.0


This would upgrade lxml to the most recent version between 2.2.0 and 2.3.0.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download