[Distutils] pip install --upgrade bug on python3.x
Paul Moore
p.f.moore at gmail.com
Wed Jan 9 00:24:17 CET 2013
On 8 January 2013 22:29, Christian Tismer <tismer at stackless.com> wrote:
> So why is it so difficult to just use "except ValueError as e" ?
>
> Am I missing the point, or would it not just work with python 2.7 and up?
The problem is that distribute supports Python 2.4 and up. Until they
drop support for at least 2.4 and 2.5, they don't stand a chance of
moving away from 2to3 to a single-source model (and even then, it's a
lot of work for little benefit so they may not want to take that step
anyway). It's the 2to3 process that's the issue here.
The issue with pip upgrade is then that pip uses distribute as part of
the upgrade command, and you hit nasty self-reference problems as
documented in pip issue #650. It's only a problem for distribute, not
for other projects using 2to3, precisely because pip upgrade relies on
distribute to do its work. There may be a workaround which can be
added to pip (that would be a fix for issue #650), but it genuinely is
a relatively minor issue because:
1. It only affects distribute, not all 2to3-using packages.
2. It's easy enough to work around by doing a manual "setup.py
install" style installation of distribute.
3. A certain proportion of people probably just rebuild their
virtualenvs if they want to upgrade distribute (I know I do, but it
depends on your working practices, I guess).
4. Even if this problem was fixed, using distribute to upgrade itself
will probably still not work on Windows, due to the process attempting
to overwrite open files (I don't know this for certain, but I suspect
it).
As far as the question of people's perception of Python 3 goes, I
would expect that the explanation that "distribute is a special case
because it's part of the machinery used to implement pip upgrade and
it can't upgrade itself - you can work around the issue like this (2
above)" would be acceptable to most people - assuming they were not
simply looking for an excuse to prefer Python 2.
FWIW, I'll try to spend some time looking at #650. I don't expect a
complete fix, although at a minimum I would hope that it's possible to
do at least some of the following:
- add some comments to the documentation
- allow the user to specify that pip should never upgrade distribute
(issue #654)
- never attempt to upgrade distribute due to implicit dependency
resolution (i.e., the user has to explicitly specify it on the command
line)
- raise an error with a better explanation of the issue if the user
does attempt to manually upgrade distribute with pip
Paul
Paul
More information about the Distutils-SIG
mailing list