[Bug 1298831] Re: pyvenv environments not usable without activation
Marcel Martin
1298831 at bugs.launchpad.net
Fri Mar 28 16:11:41 UTC 2014
apport information
** Tags added: apport-collected saucy
** Description changed:
Virtual environments created with pyvenv are supposed to be usable without 'activation', according to Python's docs.
With Ubuntu's Python 3.3 packages, however, the sys.path is incomplete unless the environment variable VIRTUAL_ENV is set.
$ cd /tmp
$ pyvenv-3.3 venv
$ venv/bin/python -c 'import sys;print(sys.path)'
['', '/usr/lib/python3.3', '/usr/lib/python3.3/plat-x86_64-linux-gnu', '/usr/lib/python3.3/lib-dynload']
When I create a test module, I cannot import it:
$ echo 'print("Hello")' > venv/lib/python3.3/site-packages/hello.py
$ venv/bin/python -c 'import hello'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named 'hello'
When I set VIRTUAL_ENV (simulating activation), the sys.path is complete
and it works:
$ VIRTUAL_ENV=/tmp/venv venv/bin/python -c 'import sys;print(sys.path)'
['', '/usr/lib/python3.3', '/usr/lib/python3.3/plat-x86_64-linux-gnu', '/usr/lib/python3.3/lib-dynload', '/tmp/venv/lib/python3.3/site-packages']
$ VIRTUAL_ENV=/tmp/venv venv/bin/python -c 'import hello'
Hello
The latter output is what I also get with a Python manually compiled
from sources, but even without the VIRTUAL_ENV variable being set.
This may be related:
- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=695758
- https://bugs.launchpad.net/ubuntu/+source/python3.3/+bug/1093193
Versions:
Ubuntu 13.10
Python 3.3.2-7ubuntu3.1
+ ---
+ ApportVersion: 2.12.5-0ubuntu2.2
+ Architecture: amd64
+ DistroRelease: Ubuntu 13.10
+ InstallationDate: Installed on 2012-04-14 (713 days ago)
+ InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release amd64 (20110427)
+ MarkForUpload: True
+ Package: python3.3 3.3.2-7ubuntu3.1
+ PackageArchitecture: amd64
+ ProcVersionSignature: Ubuntu 3.8.0-22.33-generic 3.8.11
+ Tags: saucy
+ Uname: Linux 3.8.0-22-generic x86_64
+ UpgradeStatus: Upgraded to saucy on 2013-10-18 (161 days ago)
+ UserGroups:
** Attachment added: "Dependencies.txt"
https://bugs.launchpad.net/bugs/1298831/+attachment/4048887/+files/Dependencies.txt
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python3.3 in Ubuntu.
https://bugs.launchpad.net/bugs/1298831
Title:
pyvenv environments not usable without activation
Status in “python3.3” package in Ubuntu:
Confirmed
Bug description:
Virtual environments created with pyvenv are supposed to be usable without 'activation', according to Python's docs.
With Ubuntu's Python 3.3 packages, however, the sys.path is incomplete unless the environment variable VIRTUAL_ENV is set.
$ cd /tmp
$ pyvenv-3.3 venv
$ venv/bin/python -c 'import sys;print(sys.path)'
['', '/usr/lib/python3.3', '/usr/lib/python3.3/plat-x86_64-linux-gnu', '/usr/lib/python3.3/lib-dynload']
When I create a test module, I cannot import it:
$ echo 'print("Hello")' > venv/lib/python3.3/site-packages/hello.py
$ venv/bin/python -c 'import hello'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named 'hello'
When I set VIRTUAL_ENV (simulating activation), the sys.path is
complete and it works:
$ VIRTUAL_ENV=/tmp/venv venv/bin/python -c 'import sys;print(sys.path)'
['', '/usr/lib/python3.3', '/usr/lib/python3.3/plat-x86_64-linux-gnu', '/usr/lib/python3.3/lib-dynload', '/tmp/venv/lib/python3.3/site-packages']
$ VIRTUAL_ENV=/tmp/venv venv/bin/python -c 'import hello'
Hello
The latter output is what I also get with a Python manually compiled
from sources, but even without the VIRTUAL_ENV variable being set.
This may be related:
- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=695758
- https://bugs.launchpad.net/ubuntu/+source/python3.3/+bug/1093193
Versions:
Ubuntu 13.10
Python 3.3.2-7ubuntu3.1
---
ApportVersion: 2.12.5-0ubuntu2.2
Architecture: amd64
DistroRelease: Ubuntu 13.10
InstallationDate: Installed on 2012-04-14 (713 days ago)
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release amd64 (20110427)
MarkForUpload: True
Package: python3.3 3.3.2-7ubuntu3.1
PackageArchitecture: amd64
ProcVersionSignature: Ubuntu 3.8.0-22.33-generic 3.8.11
Tags: saucy
Uname: Linux 3.8.0-22-generic x86_64
UpgradeStatus: Upgraded to saucy on 2013-10-18 (161 days ago)
UserGroups:
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python3.3/+bug/1298831/+subscriptions
More information about the foundations-bugs
mailing list