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

WindowsError: during `pip install -U setuptools` (Anaconda) #1036

Open wowkin2 opened 7 years ago

wowkin2 commented 7 years ago
(C:\Users\admin\Anaconda2) C:\Users\admin\Downloads>pip install -U setuptools
Collecting setuptools
  Downloading setuptools-35.0.2-py2.py3-none-any.whl (390kB)
    100% |################################| 399kB 1.1MB/s
Collecting appdirs>=1.4.0 (from setuptools)
  Downloading appdirs-1.4.3-py2.py3-none-any.whl
Collecting packaging>=16.8 (from setuptools)
  Downloading packaging-16.8-py2.py3-none-any.whl
Requirement already up-to-date: six>=1.6.0 in c:\users\admin\anaconda2\lib\site-packages (from setuptools)
Collecting pyparsing (from packaging>=16.8->setuptools)
  Downloading pyparsing-2.2.0-py2.py3-none-any.whl (56kB)
    100% |################################| 61kB 1.3MB/s
Installing collected packages: appdirs, pyparsing, packaging, setuptools
  Found existing installation: pyparsing 2.1.4
    Uninstalling pyparsing-2.1.4:
      Successfully uninstalled pyparsing-2.1.4
  Found existing installation: setuptools 27.2.0
    Uninstalling setuptools-27.2.0:
      Successfully uninstalled setuptools-27.2.0
Successfully installed appdirs-1.4.3 packaging-16.8 pyparsing-2.2.0 setuptools-35.0.2
Traceback (most recent call last):
  File "C:\Users\admin\Anaconda2\Scripts\pip-script.py", line 5, in <module>
    sys.exit(pip.main())
  File "C:\Users\admin\Anaconda2\lib\site-packages\pip\__init__.py", line 249, in main
    return command.main(cmd_args)
  File "C:\Users\admin\Anaconda2\lib\site-packages\pip\basecommand.py", line 252, in main
    pip_version_check(session)
  File "C:\Users\admin\Anaconda2\lib\site-packages\pip\utils\outdated.py", line 102, in pip_version_check
    installed_version = get_installed_version("pip")
  File "C:\Users\admin\Anaconda2\lib\site-packages\pip\utils\__init__.py", line 838, in get_installed_version
    working_set = pkg_resources.WorkingSet()
  File "C:\Users\admin\Anaconda2\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 644, in __init__
    self.add_entry(entry)
  File "C:\Users\admin\Anaconda2\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 700, in add_entry
    for dist in find_distributions(entry, True):
  File "C:\Users\admin\Anaconda2\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 1949, in find_eggs_in_zip
    if metadata.has_metadata('PKG-INFO'):
  File "C:\Users\admin\Anaconda2\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 1463, in has_metadata
    return self.egg_info and self._has(self._fn(self.egg_info, name))
  File "C:\Users\admin\Anaconda2\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 1823, in _has
    return zip_path in self.zipinfo or zip_path in self._index()
  File "C:\Users\admin\Anaconda2\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 1703, in zipinfo
    return self._zip_manifests.load(self.loader.archive)
  File "C:\Users\admin\Anaconda2\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 1643, in load
    mtime = os.stat(path).st_mtime
WindowsError: [Error 2] The system cannot find the file specified: 'C:\\Users\\admin\\Anaconda2\\lib\\site-packages\\setuptools-27.2.0-py2.7.egg'

But it works find if I removed -U:

(C:\Users\admin\Anaconda2) C:\Users\admin\Downloads>pip install setuptools
Requirement already satisfied: setuptools in c:\users\admin\anaconda2\lib\site-packages
Requirement already satisfied: appdirs>=1.4.0 in c:\users\admin\anaconda2\lib\site-packages (from setuptools)
Requirement already satisfied: packaging>=16.8 in c:\users\admin\anaconda2\lib\site-packages (from setuptools)
Requirement already satisfied: six>=1.6.0 in c:\users\admin\anaconda2\lib\site-packages (from setuptools)
Requirement already satisfied: pyparsing in c:\users\admin\anaconda2\lib\site-packages (from packaging>=16.8->setuptools)
jaraco commented 7 years ago

This issue was also reported in pypa/pip#4234. I'm fairly certain the issue would not have occurred if the setuptools you're upgrading was not a zip egg. It's conceivable that the issue could be fixed in pkg_resources. Someone will have to delve further to ascertain the underlying cause and devise a solution.

dmwyatt commented 5 years ago

I was getting this exact problem with the same stack trace (slightly different line numbers which I think is due to this being 2019 and the issue was reported in 2017.

I used pip's --force-reinstall to make it work.