pypa/pip

Old version of package in build/ prevents upgrade

scjody opened this issue · 13 comments

If an old version of a package exists in build/ for whatever reason (possibly issue 413, possibly another issue), that version will be installed rather than the requested (or latest) version.

(pip_test)scjody@ailuropoda:~/pip_test$ grep ^Version build/Django/PKG-INFO 
Version: 1.4.1
(pip_test)scjody@ailuropoda:~/pip_test$ pip install Django==1.4.2
Downloading/unpacking Django==1.4.2
  Running setup.py egg_info for package Django

Installing collected packages: Django
  Running setup.py install for Django

    changing mode of /home/scjody/pip_test/bin/django-admin.py to 755
Successfully installed Django
Cleaning up...
(pip_test)scjody@ailuropoda:~/pip_test$ pip freeze |grep Django
Django==1.4.1

As a workaround, create a new temporary directory and set --build=/that/directory before running pip. If you're calling pip from Python code, you can do something like this:

import shutil
import tempdir
[...]
build_dir = tempfile.mkdtemp()
command = "bin/pip install --build=%s some-package" % build_dir
sh(command)
shutil.rmtree(build_dir)

What version of pip did you test this with?

The output above is from pip 1.1, but it also happens with pip 1.2.1.

I've seen pip 1.2.1 warn you that it isn't installing the requested version, but that doesn't happen all the time (I can't get it to happen right now for example) and it's still pretty bad behaviour if you're calling pip from a script.

Here's what 1.2.1 is doing for me right now:

(pip_test)scjody@ailuropoda:~/pip_test$ pip --version
pip 1.2.1 from /home/scjody/pip_test/lib/python2.7/site-packages (python 2.7)
(pip_test)scjody@ailuropoda:~/pip_test$ pip install Django
Downloading/unpacking Django
  Running setup.py egg_info for package Django

Installing collected packages: Django
  Running setup.py install for Django
    changing mode of build/scripts-2.7/django-admin.py from 644 to 755

    changing mode of /home/scjody/pip_test/bin/django-admin.py to 755
Successfully installed Django
Cleaning up...
(pip_test)scjody@ailuropoda:~/pip_test$ pip freeze |grep Django
Django==1.4.1

We're seeing this issue with Pip 1.3.1 as well.. I've replicated it several times this morning. Manually clearing the build dir does fix it, but thats a really ugly step.

Any time you ask Pip for version XYZ of an app, it should always go out and look specifically for that version if it doesn't have it locally. It should not throw the message:

Requested kazoo==0.9, but installing version 1.0b1

i just saw the same thing happen with pip 1.3.1 as well. was unable to downgrade a previously-installed, then uninstalled package.

Requested pika==0.9.8, but installing version 0.9.9

the same workaround described above was effective.

Any time you ask Pip for version XYZ of an app, it should always go out and look specifically for that version if it doesn't have it locally.

Agreed! Oh generous pip developers, please fix this! pip is great, but this is crumby.

pull #712 has a solution, but I think the consensus was to trim it out part of it.
will post again soon with the non-controversial part.

Quite of the same problem here:
If I do
pip install -U djangorestframework or
pip install djangorestframework==2.2.4 or
pip install djangorestframework

I get this, even if I uninstalled it first, the only thing that worked was remove djangorestframework from build directory.

One thing to highlight is that I had installed it from git repository the first time.

$ pip install -U djangorestframework
Downloading/unpacking djangorestframework==2.2.4
  Running setup.py egg_info for package djangorestframework

    warning: no files found matching '*.txt' under directory 'rest_framework/templates'
  Requested djangorestframework==2.2.4, but installing version 2.2.0
Installing collected packages: djangorestframework
  Running setup.py install for djangorestframework

    warning: no files found matching '*.txt' under directory 'rest_framework/templates'
Successfully installed djangorestframework
Cleaning up...

closing due to merge of #865

Added my comment to the windows local temp directory you need to delete to work around this. Once I deleted this directory everything worked fine. I am on pip 1.3.1

http://siddhi.blogspot.com/2011/09/pip-re-installing-wrong-version-of.html

It still doesnt work in windows 7.

this will only be fixed in 1.4, which is not released yet.

Nice great work guys!

Sent from my iPhone

On May 22, 2013, at 7:12 PM, Marcus Smith notifications@github.com wrote:

this will only be fixed in 1.4, which is not released yet.


Reply to this email directly or view it on GitHub.

THANK GOD