virtual environment not created before sourcing it when OFFLINE is False and TRACK_DEPENDS is True

Bug #1677193 reported by Jose Luis Franco
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
devstack
Won't Fix
Low
Unassigned

Bug Description

When installing Devstack configuring the environment variables OFFLINE and TRACK_DEPENDS to the following values:
OFFLINE=False
TRACK_DEPENDS=True

the following error is obtained:
2017-03-29 10:06:14.247 | + tools/install_pip.sh:install_get_pip:92 : sudo -H -E python /home/bbscuser/devstack/files/get-pip.py -c /home/bbscuser/devstack/tools/cap-pip.txt
2017-03-29 10:06:15.685 | Requirement already up-to-date: pip!=8 in /usr/local/lib/python2.7/dist-packages (from -c /home/bbscuser/devstack/tools/cap-pip.txt (line 1))
2017-03-29 10:06:16.192 | + tools/install_pip.sh:install_get_pip:93 : python3_enabled
2017-03-29 10:06:16.194 | + inc/python:python3_enabled:545 : [[ False == \T\r\u\e ]]
2017-03-29 10:06:16.196 | + inc/python:python3_enabled:548 : return 1
2017-03-29 10:06:16.198 | + tools/install_pip.sh:main:142 : [[ -n '' ]]
2017-03-29 10:06:16.200 | + tools/install_pip.sh:main:146 : set -x
2017-03-29 10:06:16.201 | + tools/install_pip.sh:main:150 : pip_install_gr setuptools
2017-03-29 10:06:16.203 | + inc/python:pip_install_gr:66 : local name=setuptools
2017-03-29 10:06:16.205 | + inc/python:pip_install_gr:67 : local clean_name
2017-03-29 10:06:16.207 | ++ inc/python:pip_install_gr:68 : get_from_global_requirements setuptools
2017-03-29 10:06:16.209 | ++ inc/python:get_from_global_requirements:357 : local package=setuptools
2017-03-29 10:06:16.211 | ++ inc/python:get_from_global_requirements:358 : local required_pkg
2017-03-29 10:06:16.214 | +++ inc/python:get_from_global_requirements:359 : grep -i -h '^setuptools' /opt/stack/requirements/global-requirements.txt
2017-03-29 10:06:16.214 | +++ inc/python:get_from_global_requirements:359 : cut -d# -f1
2017-03-29 10:06:16.217 | ++ inc/python:get_from_global_requirements:359 : required_pkg='setuptools>=16.0,!=24.0.0,!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2.0,!=34.3.0,!=34.3.1 '
2017-03-29 10:06:16.219 | ++ inc/python:get_from_global_requirements:360 : [[ setuptools>=16.0,!=24.0.0,!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2.0,!=34.3.0,!=34.3.1 == '' ]]
2017-03-29 10:06:16.221 | ++ inc/python:get_from_global_requirements:363 : echo 'setuptools>=16.0,!=24.0.0,!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2.0,!=34.3.0,!=34.3.1'
2017-03-29 10:06:16.223 | + inc/python:pip_install_gr:68 : clean_name='setuptools>=16.0,!=24.0.0,!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2.0,!=34.3.0,!=34.3.1'
2017-03-29 10:06:16.225 | + inc/python:pip_install_gr:69 : pip_install 'setuptools>=16.0,!=24.0.0,!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2.0,!=34.3.0,!=34.3.1'
2017-03-29 10:06:16.240 | /home/bbscuser/devstack/inc/python: line 248: /opt/stack/.venv/bin/activate: No such file or directory
2017-03-29 10:06:16.248 | ++./stack.sh:main:729 err_trap
2017-03-29 10:06:16.255 | ++./stack.sh:err_trap:517 local r=1

The reason for this error is in the stack.sh script, the Python virtual environment when TRACK_DEPENDS is set to True is created in line 743:
virtualenv --system-site-packages $DEST/.venv

However, the function pip_install in the inc/python script tries to source the virtual environment when TRACK_DEPENDS flag is set:
    if [[ $TRACK_DEPENDS = True && ! "$@" =~ virtualenv ]]; then
        # TRACK_DEPENDS=True installation creates a circular dependency when
        # we attempt to install virtualenv into a virtualenv, so we must global
        # that installation.
        source $DEST/.venv/bin/activate
        local cmd_pip=$DEST/.venv/bin/pip
        local sudo_pip="env"
    else

This function is called from stack.sh few lines before the virtual environment is created, causing that the /opt/stack/.venv/bin/activate file won't exist at that moment int time.

A solution would be moving the whole block that creates the virtual environment in stack.sh script (lines 735 to 746) before calling the tools/install_pip.sh script (line 727)

Revision history for this message
Jose Luis Franco (jfrancoa) wrote :

This bug is similar to this one:

https://bugs.launchpad.net/devstack/+bug/1208867

Changed in devstack:
status: New → Triaged
importance: Undecided → Low
Revision history for this message
Dr. Jens Harbott (j-harbott) wrote :
Changed in devstack:
status: Triaged → Won't Fix
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.