Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip (1.3.1) not upgrading packages until the local cache is deleted

Tags:

python

pip

I am trying to upgrade PACKAGENAME using the following:

pip install --index http://pypi.MYSITE.com/simple/ --upgrade PACKAGENAME

I often see that no files are downloaded from the server and pip says all packages were installed successfully, but when I check the version installed it is not the newest version on the server.

However, if I delete pip's cache and run the above command again, it does download files from the server and install the newest version. Has anyone experienced this issue?

One workaround I found is to pass the --ignore-installed argument to pip install, but this causes pip to download all packages from server even if the newest version is already installed.

like image 540
Jace Browning Avatar asked Jun 13 '13 14:06

Jace Browning


People also ask

Can I delete the pip cache?

If you want to force pip to clear out its download cache and use the specific version you can do by using --no-cache-dir command. If you are using an older version of pip than upgrade it with pip install -U pip. This will help you clear pip cache.

Why is pip using cached?

The caching mechanism allows pip to improve the download and installation of the packages. This is because pip does not need to download already existing packages. In some cases, pip may not need to redownload a package when updating if it already exists in the cache.

Why is pip downloading all versions?

A new dependency resolver was released, and it's obviously causing this ridiculous infinite loop downloading all previous versions. The article above mentions that You can use the deprecated (old) resolver, using the flag --use-deprecated=legacy-resolver, until we remove it in the pip 21.0 release in January 2021.


1 Answers

It is the issue in pip 1.3.1, I met same problem in Ubuntu 12.10 and Windows, Upgrade to pip 1.4 (so far latest) can solve this problem

There are conflicts in the cache, if you upgrade to 1.4 like using virtualenv if you don't want to update the real environment, you will see the error message.

like image 119
Larry Cai Avatar answered Oct 11 '22 11:10

Larry Cai