[Bug 1298831] [NEW] pyvenv environments not usable without activation
Marcel Martin
1298831 at bugs.launchpad.net
Fri Mar 28 07:55:25 UTC 2014
Public bug reported:
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
** Affects: python3.3 (Ubuntu)
Importance: Undecided
Status: New
--
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:
New
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
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