[Distutils] pip/easy_install mercurial in virtualenv on Python 3.3
Christian Tismer
tismer at stackless.com
Mon Feb 25 19:23:32 CET 2013
Hi Carl,
On 25.02.13 18:38, Carl Meyer wrote:
> On 02/25/2013 10:31 AM, Christian Tismer wrote:
>> Actually, I would love to have both python2 and python3 in the same
>> virtualenv, for testing purposes, distinguishing the versions by using
>> the different interpreter, only.
>> But installing both versions after another messes things up very much
>> and led to the effect that I always got python3, even if I explicitly ran
>>
>> (virtenv) $ python2
>>
>> Python 3.3.0 (default, Dec 29 2012, 18:23:00)
>> ...
> That's interesting. I'd expect that if you first created a venv using
> Python 3, then removed the "python" symlink leaving only "python3", then
> installed a Python 2 virtualenv in the same location, things would work
> as you wish them to (at least on Linux/OSX; superimposed venvs don't
> work at all on Windows AFAIK because the Lib directories aren't versioned).
Probably it would, yes. But I just blindly installed them one after the
other,
with that slightly funny effect ;-)
Not doing this any longer at all...
>
>>>> And who is responsible to make things "right":
>>>> Should virtualenv avoid this naming problem,
>>>> or should the mercurial installer become more carefully specify its
>>>> interpreter?
>>> In general, I think that it is wrong for system-installed scripts to
>>> ever use "/usr/bin/env python" in the shebang line, as that makes it too
>>> easy for them to be run with the wrong Python. I know that, for
>>> instance, it is the policy of Debian/Ubuntu to not use "#!/usr/bin/env
>>> python". I don't know what homebrew's policy is, but I'd suggest raising
>>> this as a bug in the Homebrew Mercurial package.
>>>
>> Thank you. Yes I feared that I would have to prove it to be a hg bug
>> (again), not always the nicest experience ;-)
> Well, let's distinguish between "Mercurial bug" and "bug in Homebrew
> recipe for Mercurial" - usually the latter is the responsibility of
> Homebrew, not Mercurial. I don't know what the Homebrew people will say,
> but my guess is you are more likely to see this fixed at the Homebrew
> level than in Mercurial itself.
>
Yes, you are right. Homebrew is wrong here. The mercurial installer
replaces the shebang line, if I do
$ pip install mercurial
using the python2, which installs fine with homebrew and includes pip.
While a homebrew install of mercurial does not adjust that line.
( Quite similar to a lot of packages which are just wrong in homebrew,
see pyside (I made my own for py2 and py3)).
To get this to an end:
It makes little sense to try to install mercurial on python3 at all, since
the 2to3 conversion fails!
That means my recommendation becomes:
- do a system install of mercurial using pip!
After that, you have a hg command that also works in a venv on python3 :-)
(Sigh!! That was a bit tricky)
Now I can write my how-to for OS X:
- install homebrew
- $ brew install python
- $ brew install python3 #(optional, for python3 converts like me)
- $ pip install mercurial
thanks & cheers -- chris
--
Christian Tismer :^) <mailto:tismer at stackless.com>
Software Consulting : Have a break! Take a ride on Python's
Karl-Liebknecht-Str. 121 : *Starship* http://starship.python.net/
14482 Potsdam : PGP key -> http://pgp.uni-mainz.de
phone +49 173 24 18 776 fax +49 (30) 700143-0023
PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
whom do you want to sponsor today? http://www.stackless.com/
More information about the Distutils-SIG
mailing list