Why is pip installing an old version of my package?

This is an excellent question. It took me forever to figure out. This is the solution that works for me:

Apparently, if pip can find a local version of the package, pip will prefer the local versions to remote ones. I even disconnected my computer from the internet and tried it again -- when pip still installed the package successfully, and didn't even complain, the source was obviously local.

The really confusing part, in my case, was that pip found the newer versions on pypi, reported them, and then went ahead and re-installed the older version anyway ... arggh. Also, it didn't tell me what it was doing, and why.

So how did I solve this problem?

You can get pip to give verbose output using the -v flag ... but one isn't enough. I RTFM-ed the help, which said you can do -v multiple times, up to 3x, for more verbose output. So I did:

pip install -vvv <my_package>

Then I looked through the output. One line caught my eye:

Source in /tmp/pip-build-root/ has version 0.0.11, which satisfies requirement <my_package>

I deleted that directory, after which pip installed the newest version from pypi.


Try forcing download the package again with:

pip install --no-cache-dir --upgrade <package>

Thanks to Marcus Smith, who does amazing work as a maintener of pip, this was fixed in version 1.4 of pip which was released on 2013-07-23.

Relevant information from the changelog for this version

Fixed a number of issues (#413, #709, #634, #602, and #939) related to cleaning up and not reusing build directories. (Pull #865, #948)