pyvenv environments not usable without activation

Bug #1298831 reported by Marcel Martin
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python3.3 (Ubuntu)
Confirmed
Undecided
Unassigned

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:

Revision history for this message
Jörg Frings-Fürst (jff-de) wrote :

Hi,

we need some more information. From a terminal window please run:

sudo apport-collect 1298831

and then change the status of the bug to 'Confirmed'.

Jörg

Changed in python3.3 (Ubuntu):
status: New → Incomplete
Revision history for this message
Marcel Martin (marcel) wrote : Dependencies.txt

apport information

tags: added: apport-collected saucy
description: updated
Revision history for this message
Marcel Martin (marcel) wrote : ProcEnviron.txt

apport information

Changed in python3.3 (Ubuntu):
status: Incomplete → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.