Your message dated Wed, 14 Dec 2011 21:06:39 +0000
with message-id <[email protected]>
and subject line Bug#625784: fixed in python-virtualenv 1.7-1
has caused the Debian Bug report #625784,
regarding python-virtualenv: 'virtualenv -p python3 xx' should work but doesn't
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
625784: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=625784
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: python-virtualenv
Version: 1.4.9-3ubuntu1
Severity: important
On Wheezy, which has virtualenv 1.6, the following should work:
$ virtualenv -p python3 /tmp/xx
but it fails with this traceback:
-----snip snip-----
Traceback (most recent call last):
File "/usr/lib/python2.6/dist-packages/virtualenv.py", line 1892, in <module>
main()
File "/usr/lib/python2.6/dist-packages/virtualenv.py", line 753, in main
prompt=options.prompt)
File "/usr/lib/python2.6/dist-packages/virtualenv.py", line 851, in
create_environment
install_distribute(py_executable, unzip=unzip_setuptools)
File "/usr/lib/python2.6/dist-packages/virtualenv.py", line 575, in
install_distribute
_install_req(py_executable, unzip, distribute=True)
File "/usr/lib/python2.6/dist-packages/virtualenv.py", line 474, in
_install_req
import pkg_resources
File "/usr/share/pyshared/pkg_resources.py", line 45
def _bypass_ensure_directory(name, mode=0777):
^
SyntaxError: invalid token
-----snip snip-----
I've analyzed why this happens, but I haven't figured out a good fix for it
yet. Here's my analysis.
First, virtualenv supports Python 3 as of 1.6 (and PyPy 1.5 as of 1.6.1, but
that's for a different bug report). This is true even without specifically
building python-virtualenv for Python 3. In other words, in a pristine
environment, you build Python 2.7 from source --prefix=/tmp/py27 and then use
'/tmp/py27/bin/python setup.py install' from the upstream virtualenv 1.6.1
tarball, then run '/tmp/py27/bin/virtualenv -p python3 /tmp/xx' it works just
fine.
Why does it fail in Debian then? I'm glad you asked!
Notice that the traceback is actually coming from
/usr/share/pyshared/pkg_resources.py, and indeed the token 0777 is not legal
in Python 3.2. This traceback will happen even if you've installed the
python3-pkg-resource package. The traceback happens because virtualenv is
picking up the pkg_resources modules from Python 2 and *not* from Python3.
virtualenv works by re-invoking the Python interpreter you gave to the -p
option in a subprocess. The arguments to that subprocess are the absolute
path back to the virtualenv.py file and the target directory you invoked on
the command line. It also sets an environment variable so that it knows it's
running recursively. So, in our test case, this is what the subprocess runs:
$ VIRTUALENV_INTERPRETER_RUNNING=true python3
/usr/lib/python2.7/dist-packages/virtualenv.py
That *should* be perfectly fine because virtualenv.py is Python3 compatible.
Try it yourself and you'll see that that fails with the above traceback.
The reason is because of Debian's symlink farm. When virtualenv.py tries to
import pkg_resources, it picks up the one from /usr/share/pyshared instead of
the one from /usr/lib/python3/dist-packages/pkg_resources.py as you would
expect. Why is that? Well, it's because
/usr/lib/python2.7/dist-packages/virtualenv.py is a symlink to
/usr/share/pyshared/virtualenv.py and this tricks Python's default sys.path
setup.
When Python is handed a script in argv[1], it puts that directory at the front
of sys.path, but before it does so, it chases the symlink of argv[1]. So,
Python 3 starts up, sees /usr/lib/python2.7/dist-packages/virtualenv.py in
argv[1], chases that to /usr/share/pyshared/virtualenv.py, and sticks
/usr/share/pyshared at the front of sys.path. Our python-pkg-resources
package happens to drop a pkg_resources.py file in that directory, but that
file is only appropriate for Python 2. So when Python 3 tries to import
pkg_resources, it gets the one from /usr/share/pyshared and boom!
Why doesn't the same thing happen in a from-source build? Well, it's because
in a from-source build, pkg_resources doesn't live in site-packages, it lives
in site-packages/distribute-0.6.16-py2.7.egg so when Python 3 runs
.../python2.7/site-packages/virtualenv.py there is no pkg_resources.py file
right next to it, even though .../python2.7/site-packages is the first thing
on sys.path.
I don't know what the proper fix for this is though. I'll bring it up on
debian-python and see if anybody has any ideas.
-- System Information:
Debian Release: squeeze/sid
APT prefers natty-updates
APT policy: (500, 'natty-updates'), (500, 'natty-security'), (500, 'natty')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.38-8-generic (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages python-virtualenv depends on:
ii python 2.7.1-0ubuntu5 interactive high-level object-orie
ii python-pkg-resources 0.6.15-1ubuntu1 Package Discovery and Resource Acc
ii python-setuptools 0.6.15-1ubuntu1 Python Distutils Enhancements (set
ii python-support 1.0.10ubuntu3 automated rebuilding support for P
Versions of packages python-virtualenv recommends:
ii python-pip 0.8.2-0ubuntu1 alternative Python package install
python-virtualenv suggests no packages.
-- no debconf information
--- End Message ---
--- Begin Message ---
Source: python-virtualenv
Source-Version: 1.7-1
We believe that the bug you reported is fixed in the latest version of
python-virtualenv, which is due to be installed in the Debian FTP archive:
python-virtualenv_1.7-1.debian.tar.gz
to main/p/python-virtualenv/python-virtualenv_1.7-1.debian.tar.gz
python-virtualenv_1.7-1.dsc
to main/p/python-virtualenv/python-virtualenv_1.7-1.dsc
python-virtualenv_1.7-1_all.deb
to main/p/python-virtualenv/python-virtualenv_1.7-1_all.deb
python-virtualenv_1.7.orig.tar.gz
to main/p/python-virtualenv/python-virtualenv_1.7.orig.tar.gz
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Stefano Rivera <[email protected]> (supplier of updated python-virtualenv
package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Format: 1.8
Date: Wed, 14 Dec 2011 22:22:53 +0200
Source: python-virtualenv
Binary: python-virtualenv
Architecture: source all
Version: 1.7-1
Distribution: unstable
Urgency: low
Maintainer: Debian Python Modules Team
<[email protected]>
Changed-By: Stefano Rivera <[email protected]>
Description:
python-virtualenv - Python virtual environment creator
Closes: 625784 632982
Changes:
python-virtualenv (1.7-1) unstable; urgency=low
.
* Team upload.
* New upstream version. Closes: #632982
- Doesn't import pkg_resources from python2 run with -p python3
Closes: #625784, LP: #787822
* Refreshed patches.
* Bumped standards version to 3.9.2 (no changes needed).
* Updated manpage for new options:
- --system-site-packages (no longer the default)
- --extra-search-dir
- --never-download
* debian/patches/remove_syspath0_on_reinvoke.patch
- Remove the first entry from sys.path to fix failure with -p python3
* debian/patches/pep3147-dist-packges.patch
- Use the unified python3 dist-packages path in site.py
Checksums-Sha1:
0bd8393b1231be33935b5688e44e978be846a47c 2137 python-virtualenv_1.7-1.dsc
3c99e759a06470a1838c98b750d5b72972ac82d6 2125413
python-virtualenv_1.7.orig.tar.gz
a0b099b39ad2f9b927d83e20eed2f0a566bcd942 29441
python-virtualenv_1.7-1.debian.tar.gz
f193d5eba868d4ba56c004d9baf0474e7034cfa6 2129898
python-virtualenv_1.7-1_all.deb
Checksums-Sha256:
80fdac648ee5900e4223a81732b2c6275fe36cf42d0da6a3454f16ae48344094 2137
python-virtualenv_1.7-1.dsc
e32b851eec3beae048c41dedcbebdae8484752b4426436ba8d7d1d69458ef6fc 2125413
python-virtualenv_1.7.orig.tar.gz
0ce8697d59fcc46f92b93e21ab29a91f22cd4520be71703199827befc373af56 29441
python-virtualenv_1.7-1.debian.tar.gz
3f84a5db3262231386130f7dd00861bca872921cc019a1d6f2404afadcb06305 2129898
python-virtualenv_1.7-1_all.deb
Files:
cc6f188500460158039762d08552598a 2137 python optional
python-virtualenv_1.7-1.dsc
dcc105e5a3907a9dcaa978f813a4f526 2125413 python optional
python-virtualenv_1.7.orig.tar.gz
c16b4f0d0dc173dbf1166eb7c7fda3e8 29441 python optional
python-virtualenv_1.7-1.debian.tar.gz
d2d62f572713f74136f7e61d87edbfd4 2129898 python optional
python-virtualenv_1.7-1_all.deb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
iQIcBAEBAgAGBQJO6QaFAAoJEACQ/CG1zRrM+/MP/35ok+EAsH0B1k0qXLbQToJl
egZa92V1LUQqNYvWj+aXnOFd2lbrg0axrvkUcxKhOaPMnOlOmK5h/0EX1RBAlLSQ
VeFlwSJzNPRGBvvmvtYYpaHNhgud7bPcuFa2IWsYymMj8CsDflXExlYjAU/9Tnj2
BxKTTxySV1IoNXe4znTXS9NpyhhQXyv6Jq+UL0AYwez4sKsyCj62HaW/LQ4ZkCAW
XhzF3CwwGxnnRNziK+Kl1XRW0i5ELaM5ews5f7/zi+OqoBjpoQpbUb6pDKi01+Bg
yPrU57VaUdnoGHSDCXI6UiWjUx3LFoT75Gtsq5mCoKmth0cjsqo496Hm9hXovp4i
OmJahbkeRDAtECueINg3mXH3JOm+QoBbP1nqWvS+uQYcxeIg10X1AG4lhXhZMSwi
XH5bvxYdpzWdvqElA3UFTjD5yMHCVcLSkOplWYgnmuATk/YQZvfXWzrLwL79k0Pg
xQWowhx8Q0ZJJLbUchtqoiI+TpxKN84Eyx2yPqf9Z3i0f0LsEMiuCu+Mk81piFug
bo4Wa7hyCThCUJqJ5QkR3oyPVrNuPIrF0xZK4/rRP5KPkXGDz+G7k/DchgN5YD1L
j86GcJJwLKgnXRllPCY3N7AM3h2HebJjpfJV8QbydNU+TRu4Z+wt8BzNTyhac3vs
AsleGiz7d80cyf4dIDuS
=E2n2
-----END PGP SIGNATURE-----
--- End Message ---
_______________________________________________
Python-modules-team mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/python-modules-team