Skip to content

"pip install ." fails on Python 3.3 (with symlinks in local directory) #1006

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
myint opened this issue Jun 24, 2013 · 8 comments
Closed

"pip install ." fails on Python 3.3 (with symlinks in local directory) #1006

myint opened this issue Jun 24, 2013 · 8 comments
Labels
auto-locked Outdated issues that have been locked by automation

Comments

@myint
Copy link
Contributor

myint commented Jun 24, 2013

This seems to happen only if there are symlinks in the local directory. (In my case, the symlinks are from temporary build files.)

$ pip install   .
Unpacking /Users/myint/projects/docformatter
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/Users/myint/Library/Python/3.3/lib/python/site-packages/pip/basecommand.py", line 134, in main
    status = self.run(options, args)
  File "/Users/myint/Library/Python/3.3/lib/python/site-packages/pip/commands/install.py", line 235, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/Users/myint/Library/Python/3.3/lib/python/site-packages/pip/req.py", line 1084, in prepare_files
    self.unpack_url(url, location, self.is_download)
  File "/Users/myint/Library/Python/3.3/lib/python/site-packages/pip/req.py", line 1224, in unpack_url
    return unpack_file_url(link, loc)
  File "/Users/myint/Library/Python/3.3/lib/python/site-packages/pip/download.py", line 422, in unpack_file_url
    shutil.copytree(source, location)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/shutil.py", line 343, in copytree
    raise Error(errors)
shutil.Error: [('/Users/myint/projects/docformatter/.travis-solo/2.6/include/python2.6', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/2.6/include/python2.6', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/2.6/include/python2.6'"), ('/Users/myint/projects/docformatter/.travis-solo/2.6/lib/python2.6/config', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/2.6/lib/python2.6/config', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/2.6/lib/python2.6/config'"), ('/Users/myint/projects/docformatter/.travis-solo/2.6/lib/python2.6/encodings', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/2.6/lib/python2.6/encodings', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/2.6/lib/python2.6/encodings'"), ('/Users/myint/projects/docformatter/.travis-solo/2.6/lib/python2.6/lib-dynload', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/2.6/lib/python2.6/lib-dynload', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/2.6/lib/python2.6/lib-dynload'"), ('/Users/myint/projects/docformatter/.travis-solo/2.7/include/python2.7', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/2.7/include/python2.7', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/2.7/include/python2.7'"), ('/Users/myint/projects/docformatter/.travis-solo/2.7/lib/python2.7/config', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/2.7/lib/python2.7/config', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/2.7/lib/python2.7/config'"), ('/Users/myint/projects/docformatter/.travis-solo/2.7/lib/python2.7/encodings', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/2.7/lib/python2.7/encodings', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/2.7/lib/python2.7/encodings'"), ('/Users/myint/projects/docformatter/.travis-solo/2.7/lib/python2.7/lib-dynload', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/2.7/lib/python2.7/lib-dynload', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/2.7/lib/python2.7/lib-dynload'"), ('/Users/myint/projects/docformatter/.travis-solo/3.2/include/python3.2m', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/3.2/include/python3.2m', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/3.2/include/python3.2m'"), ('/Users/myint/projects/docformatter/.travis-solo/3.2/lib/python3.2/config-3.2m', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/3.2/lib/python3.2/config-3.2m', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/3.2/lib/python3.2/config-3.2m'"), ('/Users/myint/projects/docformatter/.travis-solo/3.2/lib/python3.2/encodings', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/3.2/lib/python3.2/encodings', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/3.2/lib/python3.2/encodings'"), ('/Users/myint/projects/docformatter/.travis-solo/3.2/lib/python3.2/lib-dynload', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/3.2/lib/python3.2/lib-dynload', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/3.2/lib/python3.2/lib-dynload'"), ('/Users/myint/projects/docformatter/.travis-solo/3.3/include/python3.3m', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/3.3/include/python3.3m', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/3.3/include/python3.3m'"), ('/Users/myint/projects/docformatter/.travis-solo/3.3/lib/python3.3/collections', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/3.3/lib/python3.3/collections', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/3.3/lib/python3.3/collections'"), ('/Users/myint/projects/docformatter/.travis-solo/3.3/lib/python3.3/config-3.3m', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/3.3/lib/python3.3/config-3.3m', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/3.3/lib/python3.3/config-3.3m'"), ('/Users/myint/projects/docformatter/.travis-solo/3.3/lib/python3.3/encodings', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/3.3/lib/python3.3/encodings', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/3.3/lib/python3.3/encodings'"), ('/Users/myint/projects/docformatter/.travis-solo/3.3/lib/python3.3/importlib', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/3.3/lib/python3.3/importlib', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/3.3/lib/python3.3/importlib'"), ('/Users/myint/projects/docformatter/.travis-solo/3.3/lib/python3.3/lib-dynload', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/3.3/lib/python3.3/lib-dynload', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/3.3/lib/python3.3/lib-dynload'"), ('/Users/myint/projects/docformatter/.travis-solo/3.3/lib/python3.3/plat-darwin', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/3.3/lib/python3.3/plat-darwin', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/3.3/lib/python3.3/plat-darwin'"), ('/Users/myint/projects/docformatter/.travis-solo/pypy/include', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/pypy/include', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/pypy/include'"), ('/Users/myint/projects/docformatter/.travis-solo/pypy/lib-python/2.7/encodings', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/pypy/lib-python/2.7/encodings', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/pypy/lib-python/2.7/encodings'"), ('/Users/myint/projects/docformatter/.travis-solo/python2.6/include/python2.6', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/python2.6/include/python2.6', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/python2.6/include/python2.6'"), ('/Users/myint/projects/docformatter/.travis-solo/python2.6/lib/python2.6/config', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/python2.6/lib/python2.6/config', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/python2.6/lib/python2.6/config'"), ('/Users/myint/projects/docformatter/.travis-solo/python2.6/lib/python2.6/encodings', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/python2.6/lib/python2.6/encodings', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/python2.6/lib/python2.6/encodings'"), ('/Users/myint/projects/docformatter/.travis-solo/python2.6/lib/python2.6/lib-dynload', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/python2.6/lib/python2.6/lib-dynload', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/python2.6/lib/python2.6/lib-dynload'"), ('/Users/myint/projects/docformatter/.travis-solo/python2.7/include/python2.7', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/python2.7/include/python2.7', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/python2.7/include/python2.7'"), ('/Users/myint/projects/docformatter/.travis-solo/python2.7/lib/python2.7/config', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/python2.7/lib/python2.7/config', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/python2.7/lib/python2.7/config'"), ('/Users/myint/projects/docformatter/.travis-solo/python2.7/lib/python2.7/encodings', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/python2.7/lib/python2.7/encodings', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/python2.7/lib/python2.7/encodings'"), ('/Users/myint/projects/docformatter/.travis-solo/python2.7/lib/python2.7/lib-dynload', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/python2.7/lib/python2.7/lib-dynload', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/python2.7/lib/python2.7/lib-dynload'"), ('/Users/myint/projects/docformatter/.travis-solo/python3.2/include/python3.2m', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/python3.2/include/python3.2m', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/python3.2/include/python3.2m'"), ('/Users/myint/projects/docformatter/.travis-solo/python3.2/lib/python3.2/config-3.2m', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/python3.2/lib/python3.2/config-3.2m', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/python3.2/lib/python3.2/config-3.2m'"), ('/Users/myint/projects/docformatter/.travis-solo/python3.2/lib/python3.2/encodings', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/python3.2/lib/python3.2/encodings', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/python3.2/lib/python3.2/encodings'"), ('/Users/myint/projects/docformatter/.travis-solo/python3.2/lib/python3.2/lib-dynload', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/python3.2/lib/python3.2/lib-dynload', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/python3.2/lib/python3.2/lib-dynload'"), ('/Users/myint/projects/docformatter/.travis-solo/python3.3/include/python3.3m', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/python3.3/include/python3.3m', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/python3.3/include/python3.3m'"), ('/Users/myint/projects/docformatter/.travis-solo/python3.3/lib/python3.3/collections', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/python3.3/lib/python3.3/collections', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/python3.3/lib/python3.3/collections'"), ('/Users/myint/projects/docformatter/.travis-solo/python3.3/lib/python3.3/config-3.3m', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/python3.3/lib/python3.3/config-3.3m', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/python3.3/lib/python3.3/config-3.3m'"), ('/Users/myint/projects/docformatter/.travis-solo/python3.3/lib/python3.3/encodings', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/python3.3/lib/python3.3/encodings', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/python3.3/lib/python3.3/encodings'"), ('/Users/myint/projects/docformatter/.travis-solo/python3.3/lib/python3.3/importlib', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/python3.3/lib/python3.3/importlib', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/python3.3/lib/python3.3/importlib'"), ('/Users/myint/projects/docformatter/.travis-solo/python3.3/lib/python3.3/lib-dynload', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/python3.3/lib/python3.3/lib-dynload', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/python3.3/lib/python3.3/lib-dynload'"), ('/Users/myint/projects/docformatter/.travis-solo/python3.3/lib/python3.3/plat-darwin', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-5g3qy6-build/.travis-solo/python3.3/lib/python3.3/plat-darwin', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/.travis-solo/python3.3/lib/python3.3/plat-darwin'")]

Storing complete log in /Users/myint/.pip/pip.log

This seems to be due to shutil.copytree(), which fails if there are symlinks in the source.

@qwcode
Copy link
Contributor

qwcode commented Jun 24, 2013

can you explain the details of your symlink case, or provide a repeatable case. thanks.

@myint
Copy link
Contributor Author

myint commented Jun 24, 2013

Yeah, it is easy to reproduce.

$ git clone https://github.com/myint/docformatter
$ cd docformatter
$ ln -s /tmp
$ pip install .
Unpacking /Users/myint/projects/docformatter
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/Users/myint/Library/Python/3.3/lib/python/site-packages/pip/basecommand.py", line 134, in main
    status = self.run(options, args)
  File "/Users/myint/Library/Python/3.3/lib/python/site-packages/pip/commands/install.py", line 235, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/Users/myint/Library/Python/3.3/lib/python/site-packages/pip/req.py", line 1084, in prepare_files
    self.unpack_url(url, location, self.is_download)
  File "/Users/myint/Library/Python/3.3/lib/python/site-packages/pip/req.py", line 1224, in unpack_url
    return unpack_file_url(link, loc)
  File "/Users/myint/Library/Python/3.3/lib/python/site-packages/pip/download.py", line 420, in unpack_file_url
    shutil.copytree(source, location)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/shutil.py", line 343, in copytree
    raise Error(errors)
shutil.Error: [('/Users/myint/projects/docformatter/tmp', '/var/folders/eD/eDkaCQuWHJG9f-G6kmkpgk+++TI/-Tmp-/pip-ayxv_5-build/tmp', "[Errno 21] Is a directory: '/Users/myint/projects/docformatter/tmp'")]

Note that the error goes away if I set symlinks parameter of shutil.copytree() to True in pip/download.py.

@myint
Copy link
Contributor Author

myint commented Jul 12, 2013

Any thoughts on my fix?

@qwcode
Copy link
Contributor

qwcode commented Aug 25, 2013

copytree in py2 doesn't trigger these errors. did you discover the reason py3.3 behaves like this?

to be clear, the failure is occuring when copying from src to the build location, not when installing.
you're not intending to install a symlink are you?

@dstufft
Copy link
Member

dstufft commented Aug 25, 2013

FWIW Python 3.3 changed the way rmtree() worked, it's possible they also changed the way copytree() worked too.

@myint
Copy link
Contributor Author

myint commented Aug 25, 2013

Right, copytree() is just implemented differently in Python 3.

@myint
Copy link
Contributor Author

myint commented Aug 25, 2013

Also, correct, the symlink is not meant to be installed. The symlink is just some temporary file (as in the contents of .tox or a virtualenv, which include symlinks to various locations).

mwilliamson pushed a commit to mwilliamson/pip that referenced this issue Nov 10, 2013
Without this, "pip install" crashes when encountering symlinks that
point to external paths. The culprit is "shutil.copytree()", which
throws an error in such cases if the "symlinks" parameter is not set to
"True".

This fixes pypa#1006.
@myint
Copy link
Contributor Author

myint commented Nov 12, 2013

Apparently this was already reported over a year go in #611. And it was fixed, but never merged, in #813.

@myint myint closed this as completed Nov 12, 2013
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 5, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

No branches or pull requests

3 participants