install action fails with pip-build directory error with pip > 1.2.1

Bug #1179747 reported by melanie witt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
anvil
Fix Released
Critical
Alexej Ababilov

Bug Description

Get this error output with pip 1.3.1 installed, problem goes away with pip 1.2.1.

Related change: https://github.com/pypa/pip/pull/780/files

...
...
INFO: @anvil.actions.install : Installing general.
INFO: @anvil.components : Setting up 25 distribution packages:
INFO: @anvil.components : |-- iputils
INFO: @anvil.components : |-- sudo
INFO: @anvil.components : |-- mlocate
INFO: @anvil.components : |-- curl
INFO: @anvil.components : |-- git
INFO: @anvil.components : |-- coreutils
INFO: @anvil.components : |-- python-devel
INFO: @anvil.components : |-- python
INFO: @anvil.components : |-- tcpdump
INFO: @anvil.components : |-- python-distutils-extra
INFO: @anvil.components : |-- python-setuptools
INFO: @anvil.components : |-- unzip
INFO: @anvil.components : |-- openssh-server
INFO: @anvil.components : |-- gawk
INFO: @anvil.components : |-- python-paste-deploy1.5
INFO: @anvil.components : |-- wget
INFO: @anvil.components : |-- libxslt-devel
INFO: @anvil.components : |-- python-sphinx10
INFO: @anvil.components : |-- dnsmasq-utils
INFO: @anvil.components : |-- python-webob1.0
INFO: @anvil.components : |-- python-routes1.12
INFO: @anvil.components : |-- libxml2-devel
INFO: @anvil.components : |-- psmisc
INFO: @anvil.components : |-- python-nose1.1
INFO: @anvil.components : |-- lsof
Installing: 100% |#########################################################################################################################################################################################################################################################################################| Time: 00:00:00
INFO: @anvil.components : Setting up 20 python packages:
INFO: @anvil.components : |-- nose-exclude
INFO: @anvil.components : |-- python-subunit
INFO: @anvil.components : |-- openstack.nose_plugin
INFO: @anvil.components : |-- lxml
INFO: @anvil.components : |-- testtools
INFO: @anvil.components : |-- testrepository
INFO: @anvil.components : |-- pycrypto
INFO: @anvil.components : |-- prettytable
INFO: @anvil.components : |-- pylint
INFO: @anvil.components : |-- distribute
INFO: @anvil.components : |-- keyring
INFO: @anvil.components : |-- pep8
INFO: @anvil.components : |-- nosehtmloutput
INFO: @anvil.components : |-- sqlalchemy
INFO: @anvil.components : |-- coverage
INFO: @anvil.components : |-- sqlalchemy-migrate
INFO: @anvil.components : |-- requests
INFO: @anvil.components : |-- fixtures
INFO: @anvil.components : |-- pysqlite
INFO: @anvil.components : |-- cliff
Installing: 100% |#########################################################################################################################################################################################################################################################################################| Time: 00:00:00
 _______________
/ She turned me \
\ into a newt! /
 ---------------
  \ || ||
    \ __ ||-----mm||
      \ ( )/_________)//
        (oo)/
        v--v
ProcessExecutionError: Unexpected error while running command.
Command: pip-python install -q cliff
Exit code: 1
Stdout: 'The temporary folder for building (/tmp/pip-build-melwitt) is not owned by your user!\npip will not work until the temporary folder is either deleted or owned by your user account.\n'
Stderr: 'Traceback (most recent call last):\n File "/usr/bin/pip-python", line 9, in <module>\n load_entry_point(\'pip==1.3.1\', \'console_scripts\', \'pip\')()\n File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 299, in load_entry_point\n return get_distribution(dist).load_entry_point(group, name)\n File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 2229, in load_entry_point\n return ep.load()\n File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 1948, in load\n entry = __import__(self.module_name, globals(),globals(), [\'__name__\'])\n File "/usr/lib/python2.6/site-packages/pip/__init__.py", line 9, in <module>\n from pip.util import get_installed_distributions, get_prog\n File "/usr/lib/python2.6/site-packages/pip/util.py", line 15, in <module>\n from pip.locations import site_packages, running_under_virtualenv, virtualenv_no_global\n File "/usr/lib/python2.6/site-packages/pip/locations.py", line 64, in <module>\n build_prefix = _get_build_prefix()\n File "/usr/lib/python2.6/site-packages/pip/locations.py", line 54, in _get_build_prefix\n raise pip.exceptions.InstallationError(msg)\npip.exceptions.InstallationError: The temporary folder for building (/tmp/pip-build-melwitt) is not owned by your user!\n'

Joshua Harlow (harlowja)
Changed in anvil:
status: New → Confirmed
importance: Undecided → Critical
Changed in anvil:
assignee: nobody → Alessio Ababilov (aababilov)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to anvil (stable/grizzly)

Fix proposed to branch: stable/grizzly
Review: https://review.openstack.org/30620

Revision history for this message
Alexej Ababilov (aababilov) wrote :

Possible solutions.
1. One should not run pip if euid != uid
2. Run `pip install --build PATH-TO-DIR`

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: stable/grizzly
Review: https://review.openstack.org/31225

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to anvil (stable/grizzly)

Reviewed: https://review.openstack.org/31225
Committed: http://github.com/stackforge/anvil/commit/df60b50f33e63880b3b84a4bf74fc71d24bbace9
Submitter: Jenkins
Branch: stable/grizzly

commit df60b50f33e63880b3b84a4bf74fc71d24bbace9
Author: Alessio Ababilov <email address hidden>
Date: Fri May 31 11:09:37 2013 +0400

    Do not change process UID

    When run with sudo, Anvil changed process real UID
    to SUDO_UID thus easily creating files with different owners.
    This mechanism can confuse some tools (like pip)
    Now, we can almost safely stop changing real UID and run
    prepare as non-root and bootstrap, install, start, status,
    and stop as root.

    Also, this removes dependency on sudo.

    Implements: blueprint no-uid-tricks
    Fixes: bug #1179747
    Fixes: bug #1186440
    Fixes: bug #1186448

    Change-Id: I7ae293aad7f0a5ba08962e6b6b709fe49b8b81ec

tags: added: in-stable-grizzly
Changed in anvil:
status: Confirmed → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to anvil (master)

Fix proposed to branch: master
Review: https://review.openstack.org/31537

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to anvil (master)

Reviewed: https://review.openstack.org/31537
Committed: http://github.com/stackforge/anvil/commit/0ba7f0e03b6300650d561364448bd6bbdc78ac0a
Submitter: Jenkins
Branch: master

commit 0ba7f0e03b6300650d561364448bd6bbdc78ac0a
Author: Alessio Ababilov <email address hidden>
Date: Fri May 31 11:09:37 2013 +0400

    Do not change process UID

    When run with sudo, Anvil changed process real UID
    to SUDO_UID thus easily creating files with different owners.
    This mechanism can confuse some tools (like pip)
    Now, we can almost safely stop changing real UID and run
    prepare as non-root and bootstrap, install, start, status,
    and stop as root.

    Also, this removes dependency on sudo.

    Implements: blueprint no-uid-tricks
    Fixes: bug #1179747
    Fixes: bug #1186440
    Fixes: bug #1186448

    Change-Id: I7ae293aad7f0a5ba08962e6b6b709fe49b8b81ec

Revision history for this message
Joshua Harlow (harlowja) wrote :

So that seems to only partially fix the bug.

I opened https://github.com/pypa/pip/issues/982 which hopefully will get the upstream code fixed. Its seriously pretty broken.

Changed in anvil:
status: Fix Committed → Incomplete
Revision history for this message
Joshua Harlow (harlowja) wrote :

The way to trigger this in anvil is since the bootstrap phase touches/users pip, it causes the users directory to be root owned, and then the prepare stage will fail whenever a pip command is ran.

Revision history for this message
Alexej Ababilov (aababilov) wrote :

I pass --build-dir option to pip now and the problem is fixed in Anvil now.

Changed in anvil:
status: Incomplete → Fix Committed
Revision history for this message
Joshua Harlow (harlowja) wrote :

Ok, lets see when the upstream change also lands. It seems like it still happens on master due to our usage of importing of pip classes from there codebase....

Revision history for this message
Joshua Harlow (harlowja) wrote :

Example:

Traceback (most recent call last):
  File "/home/harlowja/anvil/anvil/__main__.py", line 217, in main
    run(args)
  File "/home/harlowja/anvil/anvil/__main__.py", line 121, in run
    runner.run(persona_obj)
  File "/home/harlowja/anvil/anvil/actions/base.py", line 336, in run
    instances = self._construct_instances(persona)
  File "/home/harlowja/anvil/anvil/actions/base.py", line 215, in _construct_instances
    my_siblings = self._construct_siblings(c, d_component.siblings, sibling_params, sibling_instances)
  File "/home/harlowja/anvil/anvil/actions/base.py", line 158, in _construct_siblings
    a_sibling = importer.construct_entry_point(entry_point, **sibling_params)
  File "/home/harlowja/anvil/anvil/importer.py", line 27, in construct_entry_point
    cls = import_entry_point(fullname)
  File "/home/harlowja/anvil/anvil/importer.py", line 54, in import_entry_point
    import_module(module_name)
  File "/home/harlowja/anvil/anvil/importer.py", line 71, in import_module
    __import__(module_name)
  File "/home/harlowja/anvil/anvil/components/base_testing.py", line 28, in <module>
    from anvil.packaging.helpers import pip_helper
  File "/home/harlowja/anvil/anvil/packaging/helpers/pip_helper.py", line 21, in <module>
    from pip import util as pip_util
  File "/usr/lib/python2.6/site-packages/pip/__init__.py", line 9, in <module>
    from pip.util import get_installed_distributions, get_prog
  File "/usr/lib/python2.6/site-packages/pip/util.py", line 15, in <module>
    from pip.locations import site_packages, running_under_virtualenv, virtualenv_no_global
  File "/usr/lib/python2.6/site-packages/pip/locations.py", line 64, in <module>
    build_prefix = _get_build_prefix()
  File "/usr/lib/python2.6/site-packages/pip/locations.py", line 54, in _get_build_prefix
    raise pip.exceptions.InstallationError(msg)
InstallationError: The temporary folder for building (/tmp/pip-build-harlowja) is not owned by your user!
-bash-4.1$ rm -rfv /tmp/pip-build-harlowja
removed directory: `/tmp/pip-build-harlowja'

Seems like just importing from pip 'from pip import util as pip_util' also triggers this. PITA.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to anvil (stable/folsom)

Fix proposed to branch: stable/folsom
Review: https://review.openstack.org/38366

tags: added: in-stable-folsom
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to anvil (stable/folsom)

Reviewed: https://review.openstack.org/38366
Committed: http://github.com/stackforge/anvil/commit/e9bf64cc1a3c2668f44615f3a841122b9c950796
Submitter: Jenkins
Branch: stable/folsom

commit e9bf64cc1a3c2668f44615f3a841122b9c950796
Author: Nikita Savin <email address hidden>
Date: Tue Jul 23 13:20:54 2013 -0700

    install action fails with pip-build directory
    Bug: 1179747

    stable/grizzly solution not work for folsom. So at least run all
    python-pip as root

    Change-Id: I66b153fb186c407279317f87cc6ecd5e76dc4c4a

Joshua Harlow (harlowja)
Changed in anvil:
status: Fix Committed → Fix Released
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.