tries to modify global Python

Create issue
Issue #231 resolved
Domen Kožar created an issue

{{{ python install_dir /tmp/tmpgTIhXQ Creating directory '/home/deploy/staging/bin'. Creating directory '/home/deploy/staging/parts'. Creating directory '/home/deploy/staging/develop-eggs'. Getting distribution for 'distribute'. install_dir /home/deploy/.buildout/eggs/tmp47WUsk Before install bootstrap. Scanning installed packages Setuptools installation detected at /usr/lib/python2.6/dist-packages Non-egg installation Removing elements out of the way... Already patched. /usr/lib/python2.6/dist-packages/setuptools.egg-info already patched. After install bootstrap. Creating /usr/local/lib/python2.6/dist-packages/setuptools-0.6c11-py2.6.egg-info error: /usr/local/lib/python2.6/dist-packages/setuptools-0.6c11-py2.6.egg-info: Permission denied An error occurred when trying to install distribute 0.6.21. Look above this message for any errors that were output by easy_install. While: Bootstrapping. Getting distribution for 'distribute'. Error: Couldn't install: distribute 0.6.21


I would prefer if bootstrap installed distribute locally and would not touch global Python at all.

Comments (8)

  1. Former user Account Deleted

    I spent more time on this one.

    To reproduce:

    $ echo "[buildout]
    versions = versions
    distribute = 0.6.25
    " > buildout.cfg
    $ wget
    $ python

    The problem

    Using zc.buildout, one of main goals is to isolate environment from system packages. It seems like distribute tries to create fake setuptools egg after installation:


    Could we just add check for write permissions when creating fake eggs. I don't really understand why do we need them, but removing after_install phase it seems bootstraping works anyways. Thoughts?

  2. Jason R. Coombs

    It's not obvious to me why this is a bug with distribute. I see how the error message is surely undesirable, but I don't understand enough about buildout to know why it would trigger this error.

    For instance, why does virtualenv not suffer from the same issue? Why does the installation of distribute into a buildout cause distribute to try to patch setuptools in the system Python? I don't think it's sufficient to patch the symptom, as that's liable to lead to other problems down the road, unless we can determine why distribute isn't able to simply install into the buildout environment.

    Consider another instance - installing distribute into a PEP-370 user site packages:

    jaraco@vdev:~$ rm -R .local
    jaraco@vdev:~$ python  --user
    Extracting in /tmp/tmparOnSJ
    Now working in /tmp/tmparOnSJ/distribute-0.6.26
    Installing Distribute
    Before install bootstrap.
    Scanning installed packages
    Setuptools installation detected at /usr/lib/python2.6/dist-packages
    Not patching, --root or --prefix is installing Distribute in another location
    running install
    running bdist_egg
    running egg_info
    writing distribute.egg-info/PKG-INFO
    writing top-level names to distribute.egg-info/top_level.txt
    writing dependency_links to distribute.egg-info/dependency_links.txt
    writing entry points to distribute.egg-info/entry_points.txt
    reading manifest file 'distribute.egg-info/SOURCES.txt'
    reading manifest template ''
    warning: no files found matching 'Makefile' under directory 'docs'
    warning: no files found matching 'indexsidebar.html' under directory 'docs'
    writing manifest file 'distribute.egg-info/SOURCES.txt'
    installing library code to build/bdist.linux-x86_64/egg
    running install_lib
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.6
    creating dist
    creating 'dist/distribute-0.6.26-py2.6.egg' and adding 'build/bdist.linux-x86_64/egg' to it
    removing 'build/bdist.linux-x86_64/egg' (and everything under it)
    Processing distribute-0.6.26-py2.6.egg
    creating /home/jaraco/.local/lib/python2.6/site-packages/distribute-0.6.26-py2.6.egg
    Extracting distribute-0.6.26-py2.6.egg to /home/jaraco/.local/lib/python2.6/site-packages
    Adding distribute 0.6.26 to easy-install.pth file
    Installing easy_install script to /home/jaraco/.local/bin
    Installing easy_install-2.6 script to /home/jaraco/.local/bin
    Installed /home/jaraco/.local/lib/python2.6/site-packages/distribute-0.6.26-py2.6.egg
    Processing dependencies for distribute==0.6.26
    Finished processing dependencies for distribute==0.6.26
    After install bootstrap.
    Creating /home/jaraco/.local/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info
    Creating /home/jaraco/.local/lib/python2.6/site-packages/setuptools.pth

    As you can see in this example, the error does not occur. This suggests that the issue does not lie strictly with distribute, but that buildout is also somehow implicated. What is the mechanism that buildout uses to install distribute?

  3. Domen Kožar reporter

    I would say it is because virtualenv already implicitly supports distribute and has post_install already globally installed. Bug happens when fake egg files are not present, which is on fresh install of Ubuntu 11.0 for example.

    In any case, distribute should not have post install script writing to system paths when doing install using distutils.

  4. Jens W. Klein

    I looked at this issue and I think its some mixture issue between offered at and distribute. Who is responsible for this Where is the repository for it?

    distribute does not use the parameters passes to main call. Looks like a half-done implemenation.

    ...(to_dir=tmpeggs, download_delay=0, no_fake=True)
  5. Jason R. Coombs

    So it seems I accidentally accepted the pull request (not realizing I had reviewed it but not pushed it to the repo). So it's now released as part of 0.6.27. Please report if there are any issues with the patch.

  6. Log in to comment