

In case your requirements.txt file is located elsewhere, simply provide an absolute or relative path after -r. Image 9 - Installing multiple Python dependencies with a single command (image by author) To do so, we first have to uninstall the current version: In our case, we have version 1.5.3, but we want to go back to version 1.3.4. You now know which version of Pandas you have installed, and which versions you can potentially install, depending on your Python version. The second approach packs all that functionality in one shell command, so that’s the one you should use in practice. The first one requires two commands - the first one for uninstalling the current version, and the second for installing the version you want. There are 2 must-know ways to install a specific version of a Python package.

How to Install Pip Specific Version of a Python Package You now know how to check for the currently installed package version and also how to list all the available versions, so next, let’s see how to pip install a specific version of a package. Version 2.0.0 is the most recent, but you can go far, far back, depending on the Python version you have installed on your system or inside a virtual environment. Image 2 - Available Pandas package versions (image by author) The following shell command prints the currently installed version: Let’s check them out for the pandas Python package.


In other words - whatever the case may be, there are valid reasons for installing older versions of a Python package. Or maybe even the most recent package version isn’t compatible with your Python version. Maybe you’ve written the code years ago and it still works in production, but updating the package might break it. So, why even bother with older versions of Python packages? Well, maybe you have a huge codebase that’s not compatible with the most recent package update. Why Would You Want to Install a Specific (Older) Version of a Python Package
