Comment 0 for bug 880905

Revision history for this message
Lorin Hochstein (lorinh) wrote :

Recently, run_tests.sh inside of a virtualenv stopped working on my setup (lucid). With git bisect, I traced it down to this commit:

commit 7eeee584ad64b5a76c029641243a8fca2c875772
Author: Mark McLoughlin <email address hidden>
Date: Thu Sep 29 15:06:54 2011 +0100

    install_venv: don't use --no-site-packages with virtualenv

    libvirt isn't listed in pip-requires because (a) it's not in PyPi and
    (b) you always want to use libvirt's python bindings that matches the
    version of libvirt installed on the system.

    Currently, running nova-compute in virtualenv fails because libvirt
    can't be imported. The --no-site-packages flag is what prevents this.
    Everything seems to work fine without it. To verify, try deleting the
    no-global-site-packages.txt from your .nova-venv.

    Change-Id: I1df5e8e3c4426ca333c2d6b5b4fa8ece144dddf3

diff --git a/tools/install_venv.py b/tools/install_venv.py
index a137f11..912d0a2 100644
--- a/tools/install_venv.py
+++ b/tools/install_venv.py
@@ -89,7 +89,7 @@ def create_virtualenv(venv=VENV):
     virtual environment
     """
     print 'Creating venv...',
- run_command(['virtualenv', '-q', '--no-site-packages', VENV])
+ run_command(['virtualenv', '-q', VENV])
     print 'done.'
     print 'Installing pip in virtualenv...',
     if not run_command(['tools/with_venv.sh', 'easy_install', 'pip']).strip():

Here's the failing output. Since it's related to --no-site-packages, it's probably interfering with some package setup on my machine, but I'm not sure what packages are interfering.

Here's the error message for the package that's failing (glance). The full output is attached.

$ ./run_tests.sh -f -V
Cleaning virtualenv...
done.
Creating venv... done.
Installing pip in virtualenv... done.
Installing dependencies with pip (this can take a while)...
...
  Running setup.py install for glance
    ERROR: Python module kombu.connection not found
    ERROR: Python module swift.common.client not found
    ERROR: Python module xattr not found
    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: -c --help [cmd1 cmd2 ...]
       or: -c --help-commands
       or: -c cmd --help

    error: option --single-version-externally-managed not recognized
    Complete output from command /home/lorin/nova/.nova-venv/bin/python -c "import setuptools;__file__='/home/lorin/nova/.nova-venv/build/glance/setup.py';execfile(__file__)" install --single-version-externally-managed --record /tmp/pip-Xcyxmf-record/install-record.txt --install-headers /home/lorin/nova/.nova-venv/include/site/python2.6:
    ERROR: Python module kombu.connection not found

ERROR: Python module swift.common.client not found

ERROR: Python module xattr not found

usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]

   or: -c --help [cmd1 cmd2 ...]

   or: -c --help-commands

   or: -c cmd --help

error: option --single-version-externally-managed not recognized

----------------------------------------
Command /home/lorin/nova/.nova-venv/bin/python -c "import setuptools;__file__='/home/lorin/nova/.nova-venv/build/glance/setup.py';execfile(__file__)" install --single-version-externally-managed --record /tmp/pip-Xcyxmf-record/install-record.txt --install-headers /home/lorin/nova/.nova-venv/include/site/python2.6 failed with error code 1
Storing complete log in /home/lorin/.pip/pip.log
Command "tools/with_venv.sh pip install --upgrade -r /home/lorin/nova/tools/pip-requires" failed.