{"action":"created","issue":{"url":"https://api.github.com/repos/pypa/pip/issues/114","labels_url":"https://api.github.com/repos/pypa/pip/issues/114/labels{/name}","comments_url":"https://api.github.com/repos/pypa/pip/issues/114/comments","events_url":"https://api.github.com/repos/pypa/pip/issues/114/events","html_url":"https://github.com/pypa/pip/issues/114","id":674552,"number":114,"title":"Fails to write log file when run under sudo","user":{"login":"vbabiy","id":15382,"avatar_url":"https://avatars.githubusercontent.com/u/15382?v=3","gravatar_id":"","url":"https://api.github.com/users/vbabiy","html_url":"https://github.com/vbabiy","followers_url":"https://api.github.com/users/vbabiy/followers","following_url":"https://api.github.com/users/vbabiy/following{/other_user}","gists_url":"https://api.github.com/users/vbabiy/gists{/gist_id}","starred_url":"https://api.github.com/users/vbabiy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vbabiy/subscriptions","organizations_url":"https://api.github.com/users/vbabiy/orgs","repos_url":"https://api.github.com/users/vbabiy/repos","events_url":"https://api.github.com/users/vbabiy/events{/privacy}","received_events_url":"https://api.github.com/users/vbabiy/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pypa/pip/labels/bug","name":"bug","color":"e11d21"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2011-03-15T06:17:23Z","updated_at":"2015-08-02T00:20:25Z","closed_at":"2015-08-02T00:20:25Z","body":"`sudo pip install foo` can fail because it's trying to write the wrong user's logfile.  I think this counts as user error (you should run like `sudo -H pip ...`) but the problem is that if the log file isn't writeable then in my opinion pip should fail very early, and it doesn't. \n\nHere's some output from a run demonstrating the problem ... in this example, pip downloads and builds everything and doesn't fail until it tries to install a script over an existing script with bad permissions from a previous run. **only then** it tries to open the logfile for writing and fails to do so.\n\n    \n    $ sudo -u openplans bin/pip install -r pip-requirements.txt\n    Password: \n    Downloading/unpacking http://trac-hacks.org/svn/autoupgradeplugin/0.11/#egg=AutoUpgrade (from -r pip-requirements.txt (line 1))\n      Downloading \n      Checking out svn repository http://trac-hacks.org/svn/autoupgradeplugin/0.11/ to /tmp/pip-kMNp-a-build\n      Running setup.py egg_info for package from http://trac-hacks.org/svn/autoupgradeplugin/0.11/#egg=AutoUpgrade\n    Downloading/unpacking http://trac-hacks.org/svn/accountmanagerplugin/trunk#egg=TracAccountManager==0.2.1dev-r7737 (from -r pip-requirements.txt (line 9))\n      Downloading trunk\n      Checking out svn repository http://trac-hacks.org/svn/accountmanagerplugin/trunk to /tmp/pip-7c7Isl-build\n      Running setup.py egg_info for package from http://trac-hacks.org/svn/accountmanagerplugin/trunk#egg=TracAccountManager==0.2.1dev-r7737\n    Downloading/unpacking http://trac-hacks.org/svn/gitplugin/0.12/#egg=TracGit (from -r pip-requirements.txt (line 10))\n      Downloading \n      Checking out svn repository http://trac-hacks.org/svn/gitplugin/0.12/ to /tmp/pip-OKE8HX-build\n      Running setup.py egg_info for package from http://trac-hacks.org/svn/gitplugin/0.12/#egg=TracGit\n    Downloading/unpacking http://trac-hacks.org/svn/tagsplugin/tags/0.6/#egg=TracTags==0.6 (from -r pip-requirements.txt (line 11))\n      Downloading \n      Checking out svn repository http://trac-hacks.org/svn/tagsplugin/tags/0.6/ to /tmp/pip-Pz8tTQ-build\n      Running setup.py egg_info for package from http://trac-hacks.org/svn/tagsplugin/tags/0.6/#egg=TracTags==0.6\n    Downloading/unpacking http://trac-hacks.org/svn/tracbacksplugin/0.11/#egg=Tracbacks (from -r pip-requirements.txt (line 12))\n      Downloading \n      Checking out svn repository http://trac-hacks.org/svn/tracbacksplugin/0.11/ to /tmp/pip-T7mwA9-build\n      Running setup.py egg_info for package from http://trac-hacks.org/svn/tracbacksplugin/0.11/#egg=Tracbacks\n    Downloading/unpacking http://trac-hacks.org/svn/mailtotracplugin/0.11/#egg=mail2trac (from -r pip-requirements.txt (line 15))\n      Downloading \n      Checking out svn repository http://trac-hacks.org/svn/mailtotracplugin/0.11/ to /tmp/pip-Z6QV2W-build\n      Running setup.py egg_info for package from http://trac-hacks.org/svn/mailtotracplugin/0.11/#egg=mail2trac\n    Downloading/unpacking http://trac-hacks.org/svn/sensitiveticketsplugin/0.11/#egg=sensitivetickets (from -r pip-requirements.txt (line 17))\n      Downloading \n      Checking out svn repository http://trac-hacks.org/svn/sensitiveticketsplugin/0.11/ to /tmp/pip-DGkFZw-build\n      Running setup.py egg_info for package from http://trac-hacks.org/svn/sensitiveticketsplugin/0.11/#egg=sensitivetickets\n    Obtaining GithubPlugin from git+git://github.com/davglass/github-trac.git@ef0041201a641204ecdbbd5320d769fcf619f5f7#egg=GithubPlugin-0.4-py2.6-dev (from -r pip-requirements.txt (line 4))\n      Updating ./src/githubplugin clone (to ef0041201a641204ecdbbd5320d769fcf619f5f7)\n      Running setup.py egg_info for package GithubPlugin\n    Requirement already satisfied (use --upgrade to upgrade): gitdb==0.5.1 in ./lib/python2.5/site-packages (from -r pip-requirements.txt (line 14))\n    Requirement already satisfied (use --upgrade to upgrade): Trac==0.12 in ./lib/python2.5/site-packages (from -r pip-requirements.txt (line 8))\n    Requirement already satisfied (use --upgrade to upgrade): GitPython==0.3.0-beta2 in ./lib/python2.5/site-packages (from -r pip-requirements.txt (line 3))\n    Requirement already satisfied (use --upgrade to upgrade): WebOb==0.9.8 in ./lib/python2.5/site-packages (from -r pip-requirements.txt (line 13))\n    Requirement already satisfied (use --upgrade to upgrade): PasteDeploy==1.3.3 in ./lib/python2.5/site-packages (from -r pip-requirements.txt (line 6))\n    Requirement already satisfied (use --upgrade to upgrade): Genshi==0.6 in ./lib/python2.5/site-packages (from -r pip-requirements.txt (line 2))\n    Requirement already satisfied (use --upgrade to upgrade): Paste==1.7.4 in ./lib/python2.5/site-packages (from -r pip-requirements.txt (line 5))\n    Requirement already satisfied (use --upgrade to upgrade): martINI==0.3.2 in ./lib/python2.5/site-packages (from -r pip-requirements.txt (line 16))\n    Requirement already satisfied (use --upgrade to upgrade): PasteScript==1.7.3 in ./lib/python2.5/site-packages (from -r pip-requirements.txt (line 7))\n    Requirement already satisfied (use --upgrade to upgrade): simplejson>=2.0.5 in ./lib/python2.5/site-packages (from GithubPlugin->-r pip-requirements.txt (line 4))\n    Requirement already satisfied (use --upgrade to upgrade): async>=0.6.1 in ./lib/python2.5/site-packages (from gitdb==0.5.1->-r pip-requirements.txt (line 14))\n    Requirement already satisfied (use --upgrade to upgrade): setuptools>=0.6b1 in ./lib/python2.5/site-packages/setuptools-0.6c9-py2.5.egg (from Trac==0.12->-r pip-requirements.txt (line 8))\n    Installing collected packages: AutoUpgrade, GithubPlugin, mail2trac, sensitivetickets, TracAccountManager, Tracbacks, TracGit, TracTags\n      Running setup.py install for AutoUpgrade\n      Running setup.py develop for GithubPlugin\n        Creating /var/www/developer.openblockproject.org/lib/python2.5/site-packages/GithubPlugin.egg-link (link to .)\n        Adding GithubPlugin 0.4 to easy-install.pth file\n        \n        Installed /var/www/developer.openblockproject.org/src/githubplugin\n      Running setup.py install for mail2trac\n        Installing mail2trac script to /var/www/developer.openblockproject.org/bin\n        error: /var/www/developer.openblockproject.org/bin/mail2trac: Permission denied\n        Complete output from command /var/www/developer.openblockproject.org/bin/python -c \"import setuptools; __file__='/tmp/pip-Z6QV2W-build/setup.py'; execfile('/tmp/pip-Z6QV2W-build/setup.py')\" install --single-version-externally-managed --record /tmp/pip-ynnvpA-record/install-record.txt --install-headers /var/www/developer.openblockproject.org/include/site/python2.5:\n        running install\n    \n    running build\n    \n    running build_py\n    \n    creating build\n    \n    creating build/lib\n    \n    creating build/lib/mail2trac\n    \n    copying mail2trac/interface.py -> build/lib/mail2trac\n    \n    copying mail2trac/email2trac.py -> build/lib/mail2trac\n    \n    copying mail2trac/filters.py -> build/lib/mail2trac\n    \n    copying mail2trac/web.py -> build/lib/mail2trac\n    \n    copying mail2trac/email2ticket.py -> build/lib/mail2trac\n    \n    copying mail2trac/__init__.py -> build/lib/mail2trac\n    \n    copying mail2trac/utils.py -> build/lib/mail2trac\n    \n    running egg_info\n    \n    creating mail2trac.egg-info\n    \n    writing mail2trac.egg-info/PKG-INFO\n    \n    writing top-level names to mail2trac.egg-info/top_level.txt\n    \n    writing dependency_links to mail2trac.egg-info/dependency_links.txt\n    \n    writing entry points to mail2trac.egg-info/entry_points.txt\n    \n    writing manifest file 'mail2trac.egg-info/SOURCES.txt'\n    \n    warning: manifest_maker: standard file '-c' not found\n    \n    writing manifest file 'mail2trac.egg-info/SOURCES.txt'\n    \n    running install_lib\n    \n    copying build/lib/mail2trac/interface.py -> /var/www/developer.openblockproject.org/lib64/python2.5/site-packages/mail2trac\n    \n    copying build/lib/mail2trac/email2trac.py -> /var/www/developer.openblockproject.org/lib64/python2.5/site-packages/mail2trac\n    \n    copying build/lib/mail2trac/filters.py -> /var/www/developer.openblockproject.org/lib64/python2.5/site-packages/mail2trac\n    \n    copying build/lib/mail2trac/web.py -> /var/www/developer.openblockproject.org/lib64/python2.5/site-packages/mail2trac\n    \n    copying build/lib/mail2trac/email2ticket.py -> /var/www/developer.openblockproject.org/lib64/python2.5/site-packages/mail2trac\n    \n    copying build/lib/mail2trac/__init__.py -> /var/www/developer.openblockproject.org/lib64/python2.5/site-packages/mail2trac\n    \n    copying build/lib/mail2trac/utils.py -> /var/www/developer.openblockproject.org/lib64/python2.5/site-packages/mail2trac\n    \n    byte-compiling /var/www/developer.openblockproject.org/lib64/python2.5/site-packages/mail2trac/interface.py to interface.pyc\n    \n    byte-compiling /var/www/developer.openblockproject.org/lib64/python2.5/site-packages/mail2trac/email2trac.py to email2trac.pyc\n    \n    byte-compiling /var/www/developer.openblockproject.org/lib64/python2.5/site-packages/mail2trac/filters.py to filters.pyc\n    \n    byte-compiling /var/www/developer.openblockproject.org/lib64/python2.5/site-packages/mail2trac/web.py to web.pyc\n    \n    byte-compiling /var/www/developer.openblockproject.org/lib64/python2.5/site-packages/mail2trac/email2ticket.py to email2ticket.pyc\n    \n    byte-compiling /var/www/developer.openblockproject.org/lib64/python2.5/site-packages/mail2trac/__init__.py to __init__.pyc\n    \n    byte-compiling /var/www/developer.openblockproject.org/lib64/python2.5/site-packages/mail2trac/utils.py to utils.pyc\n    \n    running install_egg_info\n    \n    removing '/var/www/developer.openblockproject.org/lib64/python2.5/site-packages/mail2trac-0.5-py2.5.egg-info' (and everything under it)\n    \n    Copying mail2trac.egg-info to /var/www/developer.openblockproject.org/lib64/python2.5/site-packages/mail2trac-0.5-py2.5.egg-info\n    \n    running install_scripts\n    \n    Installing mail2trac script to /var/www/developer.openblockproject.org/bin\n    \n    error: /var/www/developer.openblockproject.org/bin/mail2trac: Permission denied\n    \n    ----------------------------------------\n    Command /var/www/developer.openblockproject.org/bin/python -c \"import setuptools; __file__='/tmp/pip-Z6QV2W-build/setup.py'; execfile('/tmp/pip-Z6QV2W-build/setup.py')\" install --single-version-externally-managed --record /tmp/pip-ynnvpA-record/install-record.txt --install-headers /var/www/developer.openblockproject.org/include/site/python2.5 failed with error code 1\n    Storing complete log in /home/pw/.pip/pip.log\n    Traceback (most recent call last):\n      File \"bin/pip\", line 8, in <module>\n        load_entry_point('pip==0.7.2', 'console_scripts', 'pip')()\n      File \"/var/www/openblockproject.org/lib/python2.5/site-packages/pip-0.7.2-py2.5.egg/pip/__init__.py\", line 94, in main\n      File \"/var/www/openblockproject.org/lib/python2.5/site-packages/pip-0.7.2-py2.5.egg/pip/basecommand.py\", line 139, in main\n      File \"/var/www/openblockproject.org/lib/python2.5/site-packages/pip-0.7.2-py2.5.egg/pip/basecommand.py\", line 196, in open_logfile\n    IOError: [Errno 13] Permission denied: '/home/pw/.pip/pip.log'\n    \n    \n\n---------------------------------------\n- Bitbucket: https://bitbucket.org/ianb/pip/issue/156\n- Originally Reported By:  \n- Originally Created At: 2010-08-11 21:19:52\n"},"comment":{"url":"https://api.github.com/repos/pypa/pip/issues/comments/126965935","html_url":"https://github.com/pypa/pip/issues/114#issuecomment-126965935","issue_url":"https://api.github.com/repos/pypa/pip/issues/114","id":126965935,"user":{"login":"dstufft","id":145979,"avatar_url":"https://avatars.githubusercontent.com/u/145979?v=3","gravatar_id":"","url":"https://api.github.com/users/dstufft","html_url":"https://github.com/dstufft","followers_url":"https://api.github.com/users/dstufft/followers","following_url":"https://api.github.com/users/dstufft/following{/other_user}","gists_url":"https://api.github.com/users/dstufft/gists{/gist_id}","starred_url":"https://api.github.com/users/dstufft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dstufft/subscriptions","organizations_url":"https://api.github.com/users/dstufft/orgs","repos_url":"https://api.github.com/users/dstufft/repos","events_url":"https://api.github.com/users/dstufft/events{/privacy}","received_events_url":"https://api.github.com/users/dstufft/received_events","type":"User","site_admin":false},"created_at":"2015-08-02T00:20:25Z","updated_at":"2015-08-02T00:20:25Z","body":"The logging system has gone through extensive changes, and this file is no longer written. Going to close this."}}