How to Upgrade all Python Packages with pip?

The “pip” is a package manager and a command line tool for Python to manage, uninstall, and install the packages and dependencies. However, sometimes, there are compatibility issues with the packages in which the legacy versions are not working on installed versions of “pip” or Python. In such scenarios, the user needs to upgrade the Python package for better performance and to enhance work productivity. 

This article will demonstrate how you can upgrade all Python packages with pip.

How to Upgrade All Python Packages With PIP?

On Windows, the Python packages can be installed, uninstalled, and upgraded using the “pip” package manager. To upgrade all Python packages with the “pip” commands in the “cmd”, follow the below-listed prevalent approaches: 

  1. Upgrade All Python Packages With “pip” By Creating “r” flags
  2. Upgrade all Python packages with pip using the “pip-check” Command

Launch the Command Prompt On Windows

To access the pip, the user needs to launch the “cmd” on Windows. To open the “cmd”, hit the “Win+R” keys to launch the “Run” wizard, then in the “Open:” field, type “cmd” then click on the “OK” button. This will open the Windows “cmd” prompt: 

Method 1: Upgrade All Python Packages With “pip” By Creating “r” flags

To upgrade all packages in Python all you need is to create a text file to write and store all the Python packages. For this purpose, the “r” flag needs to be created. To create a flag to upgrade all Python packages, follow the below set of instructions:

Step 1: Create a Text File to Read and Write the Upgraded Packages

To read the locally installed packages into the text file you need to construct the flag in the environment directory. To do so, execute the below-mentioned command. It will create a “packages_versions_file.txt” into the system path. To read all the packages into the text file the user needs to invoke the “pip freeze” command and then provide the name of a text file with the “.txt” extension. Here’s how you can implement this command in your administrative “cmd”:

pip freeze > packages_versions_file.txt

The “packages_versions_file.txt” file has been created in the system directory and it has all the locally installed packages and their latest versions as highlighted below: 

Step 2: Create the “r” Flag to Upgrade Python Packages

To upgrade all the Python packages you need to create the ”r” flag with “pip”. The “r” flag will upgrade the packages that are not upgraded. If they are already up-to-date packages and dependencies, then it won’t have any effect and won’t change anything in the text editor:

pip install -r packages_versions_file.txt --upgrade

Note: In our case, the packages are already upgraded and the “r” flag does make any changes to the “packages_versions_file.txt”:

Method 2: Upgrade all Python Packages With pip Using “pip-check” Commands

The pip-check is the Python package to track and manage the upgradation of all packages. The “pip-check” is a tool to trace and manage upgrades to all the Python packages. To use the “pip-check” tool you need to install it using the “pip” installation command. To implement this follow the below set of instructions:

Step 1: Installing the “pip-check” Tool With “pip” 

The command gives flexible access to users to track the current versions of the packages in Python and the release upgrade packages versions. It helps fetch the Python packages in a pretty, organized manner. To implement the “pip” command, you need to install the “pip-check” package into the Python environment. To install the “pip-check” follow the below “pip” commands: 

pip install pip-check

The command will install the “pip-check” tool with the “pip” command, as shown in the below-snap: 

Step 2: Get the List of Python Packages 

After installing “pip-check”, now you can execute the “pip-check” command successfully in “cmd”. To get the list of the latest packages, outdated package versions, and unchanged packages, execute the “pip-check” command in the “cmd”. It will give you information about outdated packages and upgraded Python packages in a more presentable and readable approach:


In our scenario, all packages are upgraded and up-to-date, so there is no information about minor or major release update packages. It only returns the unchanged packages means there is no need to upgrade them: 

Step 3: Get the List of All the Python Packages Upgraded Version 

To get the list of all the up-to-date packages, and their latest versions, use the “–show-update” flag of the “pip-check”. To extract the list of the upgraded Python Packages from your environment, utilize the following command: 

pip-check --show-update

The command will search for and fetch all the up-to-date packages and print them on “cmd”:

Step 4: Get the List of All the Python Packages That Need To Upgrade 

To display the list of packages that need to be upgraded implement the “–hide-unchanged” flag of the “pip-check”. This flag will search for the outdated Python packages, hide all the installed upgraded packages, and return the packages that require to be upgraded:

pip-check –hide-unchanged

In our case, all the packages are already up-to-date so the command returns no information and terminates after successful execution: 

Bonus Tips: Commands To Check For Updated and Outdated Packages In Python

To check the installed packages and their current versions, execute the below-mentioned command in the “cmd”:

pip list - -outdated

Alternatively, you can execute the following pip command to fetch the list of outdated packages:

pip list -o

However, to determine the up-to-date packages execute the following command in Windows “cmd”:

pip list -uptodate


pip list uptodate

This article is about upgrading all Python Packages with pip. 


To upgrade all the packages in Python with pip, first open the “cmd” on Windows using the “Win+R” keys combination. After that, execute the “r” flag command in the “cmd” using “pip”, the “r” flag will create a “.txt” file in the user’s system’s Python environment. The “.txt” file will have all the Python packages and their version information. Alternatively, install the “pip-check” package and fetch the unchanged packages and upgraded package information. This article has demonstrated the commands to upgrade all Python packages with pip.