virtualenv permission mess

Tim Molendijk avatarTim Molendijk created an issue

Unfortunately I am unable to pinpoint exactly what is causing this, but I've been tearing my hair out for many hours now and nothing I do seems to have any impact on this problem, so I'm stuck and I'm hoping the following context will ring a bell with you.

.

I setup a buildout environment by running: python bootstrap.py -d (uses Distribute instead of Setuptools).

.

My buildout.cfg:

[buildout]
eggs-directory = /usr/local/share/buildout/eggs
download-cache = /usr/local/share/buildout/cache
parts = mypart

[mypart]
recipe = gp.recipe.pip
editables = git+<github-url>#egg=MyPackage

.

Then if you run bin/buildout you will persistently get the following error:

Installing mypart.
pip install -e git+<github-url>#egg=MyPackage
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/share/buildout/eggs/pip-0.8.2-py2.6.egg/pip/__init__.py", line 116, in main
    return command.main(initial_args, args[1:], options)
  File "/usr/local/share/buildout/eggs/pip-0.8.2-py2.6.egg/pip/basecommand.py", line 113, in main
    complete_args)
  File "/usr/local/share/buildout/eggs/pip-0.8.2-py2.6.egg/pip/venv.py", line 51, in restart_in_venv
    [python, file] + args + [base, '___VENV_RESTART___'])
  File "/usr/lib/python2.6/subprocess.py", line 621, in __init__
    errread, errwrite)
  File "/usr/lib/python2.6/subprocess.py", line 1126, in _execute_child
    raise child_exception
OSError: [Errno 13] Permission denied
While:
  Installing mypart.

An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
  File "/usr/local/share/buildout/eggs/zc.buildout-1.5.2-py2.6.egg/zc/buildout/buildout.py", line 1805, in main
    getattr(buildout, command)(args)
  File "/usr/local/share/buildout/eggs/zc.buildout-1.5.2-py2.6.egg/zc/buildout/buildout.py", line 584, in install
    installed_files = self[part]._call(recipe.install)
  File "/usr/local/share/buildout/eggs/zc.buildout-1.5.2-py2.6.egg/zc/buildout/buildout.py", line 1297, in _call
    return f()
  File "/usr/local/share/buildout/eggs/gp.recipe.pip-0.5.2-py2.6.egg/gp/recipe/pip/__init__.py", line 211, in install
    return Scripts.install(self)
  File "/usr/local/share/buildout/eggs/zc.recipe.egg-1.3.2-py2.6.egg/zc/recipe/egg/egg.py", line 145, in install
    reqs, ws = self.working_set()
  File "/usr/local/share/buildout/eggs/gp.recipe.pip-0.5.2-py2.6.egg/gp/recipe/pip/__init__.py", line 152, in working_set
    self.pip_install(part_dir, build_dir, src_dir, ['-e', e])
  File "/usr/local/share/buildout/eggs/gp.recipe.pip-0.5.2-py2.6.egg/gp/recipe/pip/__init__.py", line 113, in pip_install
    raise RuntimeError('An error occur during pip installation. See %s-log.txt' % self.name)
RuntimeError: An error occur during pip installation. See mypart-log.txt

.

So... WTF?!? parts/pip does exist, but it does not contain an actual Python interpreter (or a symlink to an interpreter). Does that make sense? Also, mypart-log.txt does not seem to be created anywhere.

Comments (7)

  1. Tim Molendijk

    Btw, the exact same pip install does succeed if the buildout stuff is left out and the install is done manually in a virtualenv of my own (as opposed to a virtualenv created by buildout).

  2. Tim Molendijk

    Ok I just found out that the described behavior does not occur the very first time you run bin/buildout. The very first time you get another error:

    .

    An internal error occurred due to a bug in either zc.buildout or in a
    recipe being used:
    Traceback (most recent call last):
      File "/usr/local/share/buildout/eggs/zc.buildout-1.5.2-py2.6.egg/zc/buildout/buildout.py", line 1805, in main
        getattr(buildout, command)(args)
      File "/usr/local/share/buildout/eggs/zc.buildout-1.5.2-py2.6.egg/zc/buildout/buildout.py", line 584, in install
        installed_files = self[part]._call(recipe.install)
      File "/usr/local/share/buildout/eggs/zc.buildout-1.5.2-py2.6.egg/zc/buildout/buildout.py", line 1297, in _call
        return f()
      File "/usr/local/share/buildout/eggs/gp.recipe.pip-0.5.2-py2.6.egg/gp/recipe/pip/__init__.py", line 211, in install
        return Scripts.install(self)
      File "/usr/local/share/buildout/eggs/zc.recipe.egg-1.3.2-py2.6.egg/zc/recipe/egg/egg.py", line 145, in install
        reqs, ws = self.working_set()
      File "/usr/local/share/buildout/eggs/gp.recipe.pip-0.5.2-py2.6.egg/gp/recipe/pip/__init__.py", line 147, in working_set
        use_distribute=True)
      File "/usr/local/lib/python2.6/dist-packages/virtualenv-1.5.1-py2.6.egg/virtualenv.py", line 647, in create_environment
        site_packages=site_packages, clear=clear))
      File "/usr/local/lib/python2.6/dist-packages/virtualenv-1.5.1-py2.6.egg/virtualenv.py", line 781, in install_python
        site_filename_dst = change_prefix(site_filename, home_dir)
      File "/usr/local/lib/python2.6/dist-packages/virtualenv-1.5.1-py2.6.egg/virtualenv.py", line 710, in change_prefix
        (filename, prefixes)
    AssertionError: Filename <buildout-directory>/parts/buildout/site.py does not start with any of these prefixes: ['/usr']
    

    .

    Only if your bin/buildout again now, you will be getting the error as specified in my initial post.

  3. Tim Molendijk

    Turns out that this problem is caused by the virtualenv (/parts/pip/) not being setup successfully/correctly. If you setup a virtualenv yourself and then tell gp.recipe.pip to use that one, things go swell.

  4. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.