pypa / setuptools

Official project repository for the Setuptools build system
https://pypi.org/project/setuptools/
MIT License
2.52k stars 1.19k forks source link

setuptools fails to install wheel files with duplicate entries in .data on Windows #1362

Open wiggin15 opened 6 years ago

wiggin15 commented 6 years ago

easy_install fails to install, for example, selenium's wheel file:

> wget http://pypi/media/dists/selenium-3.11.0-py2.py3-none-any.whl\#md5\=4644b52a12a4acf352586794ef792bc9
> easy_install selenium-3.11.0-py2.py3-none-any.whl
Processing selenium-3.11.0-py2.py3-none-any.whl
removing 'c:\cygwin\home\administrator\python\lib\site-packages\selenium-3.11.0-py2.7.egg' (and everything under it)
Installing selenium-3.11.0-py2.py3-none-any.whl to c:\cygwin\home\administrator\python\lib\site-packages
error: [Error 183] Cannot create a file when that file already exists

This is because selenium contains the following files in the wheel file:

selenium/webdriver/firefox/amd64/x_ignore_nofocus.so
selenium-3.11.0.data/data/selenium/webdriver/firefox/amd64/x_ignore_nofocus.so

setuptools tries to copy all the files from .data to the base directory (https://github.com/pypa/setuptools/blob/master/setuptools/wheel.py#L146) and os.renames (https://github.com/pypa/setuptools/blob/master/setuptools/wheel.py#L38) fails on Windows when the destination already exists.

pganssle commented 6 years ago

Thanks @wiggin15. Sounds like this is indeed a bug.

I imagine the hard part of solving this is going to be writing a test for it (as is so often the case).

benoit-pierre commented 6 years ago

I still don't think this should not be supported: we should detect it and throw an error.

pganssle commented 6 years ago

@benoit-pierre I think I may have misunderstood the issue, I thought that they were files that start in different folders but have the same name, pass through some intermediate stage where they are in the same folder, and then are distributed out to new locations where they have different names.

If this is trying to install two different files in the same location, then I think it rightly should be raising an error.

wiggin15 commented 6 years ago

@pganssle I started discussion about this in https://github.com/pypa/packaging-problems/issues/152 but no action has been taken yet. If we think this case should raise an error then this should be the behavior in "pip" and "wheel" too, but in order to open an issue for these projects we need a decision in the PyPA issue.