pip uses incorrect cached package version, instead of the user-specified version
Here is an example of how to use pip to install a specific version of a package, rather than using a cached version:
Here is an example of how to use pip to install a specific version of a package, rather than using a cached version. By default, pip caches downloaded packages to speed up future installations. If a newer version is requested but the local cache isn't updated, pip may incorrectly reuse the older cached version instead of fetching the specified one.
Use pip to install a specific version of a package, rather than using a cached version
pip install package_name==version_numberFor example, if you want to install version 2.31.0 of the package "requests":
Install a specific version of a package
pip install requests==2.31.0
<div class="alert alert-info flex not-prose">![]()
<span class="hidden md:block">Watch a video course</span>Python - The Practical Guide</div>
You can also use >= or <= to specify a range of versions that you want to install.
Specify a range of versions that you want to install
pip install package_name>=version_number
pip install package_name<=version_numberAdditionally, you can use pip install --no-cache-dir package_name to force pip to ignore the cache and install the package again.