Skip to content
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

Uninstall failure: "No such file or directory: '/usr/lib/python2.7/dist-packages/setuptools.egg-info'" #2545

Closed
ionelmc opened this issue Mar 16, 2015 · 7 comments
Labels
auto-locked Outdated issues that have been locked by automation

Comments

@ionelmc
Copy link
Contributor

ionelmc commented Mar 16, 2015

root@hudson:/somewhere# PYTHONPATH=pip-6.0.8-py2.py3-none-any.whl python -mpip uninstall setuptools
+ PYTHONPATH=pip-6.0.8-py2.py3-none-any.whl
+ python -mpip uninstall setuptools wheel
Exception:
Traceback (most recent call last):
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/basecommand.py", line 232, in main
    status = self.run(options, args)
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/commands/uninstall.py", line 70, in run
    requirement_set.uninstall(auto_confirm=options.yes)
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/req/req_set.py", line 152, in uninstall
    req.uninstall(auto_confirm=auto_confirm)
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/req/req_install.py", line 555, in uninstall
    if not self.check_if_exists():
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/req/req_install.py", line 931, in check_if_exists
    self.satisfied_by = pkg_resources.get_distribution(self.req)
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py", line 461, in get_distribution
    dist = get_provider(dist)
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py", line 341, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py", line 619, in find
    if dist is not None and dist not in req:
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py", line 2859, in __contains__
    item = item.version
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py", line 2466, in version
    for line in self._get_metadata(self.PKG_INFO):
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py", line 2510, in _get_metadata
    for line in self.get_metadata_lines(name):
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py", line 1927, in get_metadata_lines
    return yield_lines(self.get_metadata(name))
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py", line 1921, in get_metadata
    with open(self.path,'rU') as f:
IOError: [Errno 2] No such file or directory: '/usr/lib/python2.7/dist-packages/setuptools.egg-info'
@ionelmc
Copy link
Contributor Author

ionelmc commented Mar 16, 2015

It's a 12.04 Ubuntu.

@ionelmc
Copy link
Contributor Author

ionelmc commented Mar 16, 2015

Seems the problem is caused by a python-setuptools installed with apt.

@ionelmc ionelmc closed this as completed Mar 16, 2015
@ionelmc
Copy link
Contributor Author

ionelmc commented Mar 16, 2015

Actually, it appears to be a spurious error? It fails but then it appears the uninstall worked:

root@hudson:/somewhere# PYTHONPATH=pip-6.0.8-py2.py3-none-any.whl python -mpip uninstall setuptools wheel
+ PYTHONPATH=pip-6.0.8-py2.py3-none-any.whl
+ python -mpip uninstall setuptools wheel
Uninstalling setuptools-1.1.6:
  /usr/local/lib/python2.7/dist-packages/setuptools-1.1.6-py2.7.egg
Proceed (y/n)? y
  Successfully uninstalled setuptools-1.1.6
Exception:
Traceback (most recent call last):
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/basecommand.py", line 232, in main
    status = self.run(options, args)
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/commands/uninstall.py", line 70, in run
    requirement_set.uninstall(auto_confirm=options.yes)
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/req/req_set.py", line 152, in uninstall
    req.uninstall(auto_confirm=auto_confirm)
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/req/req_install.py", line 555, in uninstall
    if not self.check_if_exists():
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/req/req_install.py", line 931, in check_if_exists
    self.satisfied_by = pkg_resources.get_distribution(self.req)
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py", line 461, in get_distribution
    dist = get_provider(dist)
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py", line 341, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py", line 870, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py", line 740, in resolve
    env = Environment(self.entries)
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py", line 927, in __init__
    self.scan(search_path)
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py", line 956, in scan
    for dist in find_distributions(item):
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py", line 1996, in find_eggs_in_zip
    if metadata.has_metadata('PKG-INFO'):
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py", line 1526, in has_metadata
    return self.egg_info and self._has(self._fn(self.egg_info, name))
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py", line 1884, in _has
    return zip_path in self.zipinfo or zip_path in self._index()
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py", line 1764, in zipinfo
    return self._zip_manifests.load(self.loader.archive)
  File "/somewhere/pip-6.0.8-py2.py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py", line 1704, in load
    mtime = os.stat(path).st_mtime
OSError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/setuptools-1.1.6-py2.7.egg'

root@hudson:/somewhere# PYTHONPATH=pip-6.0.8-py2.py3-none-any.whl python -mpip uninstall setuptools
+ PYTHONPATH=pip-6.0.8-py2.py3-none-any.whl
+ python -mpip uninstall setuptools
Cannot uninstall requirement setuptools, not installed

Maybe this is still worth checking.

@ionelmc ionelmc reopened this Mar 16, 2015
@piotr-dobrogost
Copy link

Duplicate of #2438?

@ionelmc
Copy link
Contributor Author

ionelmc commented Mar 16, 2015

Definitely related though I wouldn't be surprised if one can be fixed without the other.

@qwcode
Copy link
Contributor

qwcode commented Mar 29, 2015

see #2438 (comment)

I also tested your scenario (mentioned in the description) using the latest develop branch of pip, and don't get the failure

PYTHONPATH=pip-6.1.0.dev0-py2.py3-none-any.whl python -mpip uninstall -y setuptools
DEPRECATION: Uninstalling a distutils installed project (setuptools) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling setuptools-0.6rc11:
  Successfully uninstalled setuptools-0.6rc11`

and afterwards pip list does not show setuptools

BUT, "setuptools" is still importable, but not sure what can be done here, since this version of python-setuptools is using a pure distutils install and pip can't properly uninstall that as mentioned in the deprecation message

in any case, I don't think you should be removing a distro version of setuptools using pip, since it can break things that depend on python-setuptools. Do apt-cache showpkg python-setuptools and you'lll see the distro packages that depend on python-setuptools (see "Reverse Depends")

@qwcode qwcode closed this as completed Mar 29, 2015
@qwcode
Copy link
Contributor

qwcode commented Mar 29, 2015

fyi @xavfernandez ... see comment above

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