
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. pip index versions - Lists all the available package versions you can install.
pip show - Show the currently installed version of the package, its summary, author, license, dependencies, and so on. There are two useful commands you must know before proceeding to install a specific Python package version. How to Check Which Version of a Python Package is Installed Let’s now go over some practical examples of how to install a specific package version with Pip. 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 Summing up Pip Install Specific Version. How to Install Multiple Python Packages with Specific Versions. Method 2 - Overwrite the Installed Package. How to Install Pip Specific Version of a Python Package. How to Check Which Version of a Python Package is Installed. Why Would You Want to Install a Specific (Older) Version of a Python Package. Pip Install Specific Version of Package. Although there are a lot of third-party PyPI servers available (to name a few: devpi, wheelhouse or pypiserver), you need nothing besides a Python installation to fire up one yourself. It's actually pretty easy to host a local index if you need one. Overriding is also possible, via $ pip install -index-url When an index is provided via extra-index-url, pip will always search the default index at, then the extra index and install the first matching package. Multiple additional indexes can be specified in pip.conf: Example: $ pip install somepkg -extra-index-url Pip supports specifying additional repositories to look for packages these behave similarly to channels in conda<4.