cant_write_to_target: [Errno 17] File exists: '.'

Issue #138 resolved
Alexandre Conrad
created an issue

When I do a {{{python setup.py develop}}} on one of my projects, an error spawns from easy_install.py.

I'm using Python 2.5.2.


[WORKING] Here is how I do it //WITHOUT// distribute:

(skipped a blank line before each command for readability)

{{{
aconrad@r31277:~$ virtualenv pyenv --no-site-packages
New python executable in pyenv/bin/python
Installing setuptools............done.

aconrad@r31277:~$ . pyenv/bin/activate

(pyenv)aconrad@r31277:~$ cd hg/papyrus/

(pyenv)aconrad@r31277:~/hg/papyrus$ easy_install .
Processing .
Running setup.py -q bdist_egg --dist-dir /home/aconrad/hg/papyrus/egg-dist-tmp-fnaDzj
Checking .pth file support in .
/home/aconrad/pyenv/bin/python -E -c pass
Searching for PasteScript>=1.6.3
Reading http://www.pylonshq.com/download/
Best match: PasteScript 1.7.3
Downloading http://cdn.pylonshq.com/download/0.9.7/PasteScript-1.7.3.tar.gz
Processing PasteScript-1.7.3.tar.gz
Running PasteScript-1.7.3/setup.py -q bdist_egg --dist-dir /home/aconrad/hg/papyrus/temp/easy_install-WqdmIN/PasteScript-1.7.3/egg-dist-tmp-F1g5Ua

[... keeps downloading more dependencies ...]
}}}


[NOT WORKING] Now here is how I do it with Distribute, breaking the process. To emphasis the following lines, I used {{{easy_install http://bitbucket.org/tarek/distribute/get/0.6-maintenance.bz2}}} as BitBucket has caching issues and this was the only way to get the latest trunk:

{{{
aconrad@r31277:~$ virtualenv pyenv --no-site-packages
New python executable in pyenv/bin/python
Installing setuptools............done.

aconrad@r31277:~$ . pyenv/bin/activate

(pyenv)aconrad@r31277:~$ easy_install http://bitbucket.org/tarek/distribute/get/0.6-maintenance.bz2
Downloading http://bitbucket.org/tarek/distribute/get/0.6-maintenance.bz2
Processing 0.6-maintenance.bz2
Running distribute/setup.py -q bdist_egg --dist-dir /tmp/easy_install-sp3xRc/distribute/egg-dist-tmp-1P0LmO
Before install bootstrap.
Scanning installed packages
Setuptools installation detected at /home/aconrad/pyenv/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg
Egg installation
Patching...
Renaming /home/aconrad/pyenv/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg into /home/aconrad/pyenv/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg.OLD.1270571964.85
Patched done.
Relaunching...
Before install bootstrap.
Scanning installed packages
Setuptools installation detected at /home/aconrad/pyenv/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg
Egg installation
Already patched.
After install bootstrap.
Creating /home/aconrad/pyenv/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg-info
Creating /home/aconrad/pyenv/lib/python2.5/site-packages/setuptools.pth
Moving distribute-0.6.11dev-py2.5.egg to /home/aconrad/pyenv/lib/python2.5/site-packages
Adding distribute 0.6.11dev to easy-install.pth file
Installing easy_install script to /home/aconrad/pyenv/bin
Installing easy_install-2.5 script to /home/aconrad/pyenv/bin

Installed /home/aconrad/pyenv/lib/python2.5/site-packages/distribute-0.6.11dev-py2.5.egg
Processing dependencies for distribute==0.6.11dev
Finished processing dependencies for distribute==0.6.11dev

(pyenv)aconrad@r31277:~$ cd hg/papyrus/

(pyenv)aconrad@r31277:~/hg/papyrus$ easy_install .
install_dir /home/aconrad/pyenv/lib/python2.5/site-packages/
Processing .
Running setup.py -q bdist_egg --dist-dir /home/aconrad/hg/papyrus/egg-dist-tmp-GhlpLP
install_dir .
Checking .pth file support in .
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

[Errno 17] File exists: '.'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

.

Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

For information on other options, you may wish to consult the
documentation at:

http://packages.python.org/distribute/easy_install.html

Please make the appropriate changes for your system and try again.
}}}


[ALTERNATE] I have a similar error if I do {{{python setup.py develop}}}:

{{{
(pyenv)aconrad@r31277:~/hg/papyrus$ python setup.py develop
install_dir .
Traceback (most recent call last):
File "setup.py", line 40, in <module>
""",
File "/usr/lib/python2.5/distutils/core.py", line 112, in setup
_setup_distribution = dist = klass(attrs)
File "build/bdist.linux-i686/egg/setuptools/dist.py", line 221, in init
File "build/bdist.linux-i686/egg/setuptools/dist.py", line 245, in fetch_build_eggs
File "build/bdist.linux-i686/egg/pkg_resources.py", line 542, in resolve
File "build/bdist.linux-i686/egg/pkg_resources.py", line 784, in best_match
File "build/bdist.linux-i686/egg/pkg_resources.py", line 796, in obtain
File "build/bdist.linux-i686/egg/setuptools/dist.py", line 291, in fetch_build_egg
File "/usr/lib/python2.5/distutils/cmd.py", line 117, in ensure_finalized
self.finalize_options()
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 262, in finalize_options
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 384, in check_site_dir
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 468, in check_pth_processing
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 451, in cant_write_to_target
distutils.errors.DistutilsError: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

[Errno 17] File exists: '.'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

.

Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

For information on other options, you may wish to consult the
documentation at:

http://packages.python.org/distribute/easy_install.html

Please make the appropriate changes for your system and try again.
}}}


[ALTERNATE (bis)] Same error as above if I {{{python setup.py egg_info}}}

Comments (2)

  1. Tarek Ziadé repo owner

    I was able to reproduce the problem in an isolated call. The problem occurs when you use the setup_requires option:

    >>> from setuptools.dist import Distribution as D
    >>> D({'setup_requires': ['PasteScript>=1.6.3']})
    install_dir .
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "build/bdist.macosx-10.3-fat/egg/setuptools/dist.py", line 221, in __init__
      File "build/bdist.macosx-10.3-fat/egg/setuptools/dist.py", line 245, in fetch_build_eggs
      File "build/bdist.macosx-10.3-fat/egg/pkg_resources.py", line 542, in resolve
      File "build/bdist.macosx-10.3-fat/egg/pkg_resources.py", line 784, in best_match
      File "build/bdist.macosx-10.3-fat/egg/pkg_resources.py", line 796, in obtain
      File "build/bdist.macosx-10.3-fat/egg/setuptools/dist.py", line 291, in fetch_build_egg
      File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/cmd.py", line 117, in ensure_finalized
        self.finalize_options()
      File "build/bdist.macosx-10.3-fat/egg/setuptools/command/easy_install.py", line 262, in finalize_options
      File "build/bdist.macosx-10.3-fat/egg/setuptools/command/easy_install.py", line 384, in check_site_dir
      File "build/bdist.macosx-10.3-fat/egg/setuptools/command/easy_install.py", line 468, in check_pth_processing
      File "build/bdist.macosx-10.3-fat/egg/setuptools/command/easy_install.py", line 451, in cant_write_to_target
    distutils.errors.DistutilsError: can't create or remove files in install directory
    
    The following error occurred while trying to add or remove files in the
    installation directory:
    
        [Errno 17] File exists: '.'
    
    The installation directory you specified (via --install-dir, --prefix, or
    the distutils default setting) was:
    
        .
    
    Perhaps your account does not have write access to this directory?  If the
    installation directory is a system-owned directory, you may need to sign in
    as the administrator or "root" account.  If you do not have administrative
    access to this machine, you may wish to choose a different installation
    directory, preferably one that is listed in your PYTHONPATH environment
    variable.
    
    For information on other options, you may wish to consult the
    documentation at:
    
      http://packages.python.org/distribute/easy_install.html
    Please make the appropriate changes for your system and try again.
    
  2. Log in to comment