Skip to content

"No such file or directory" when trying to install or upgrade a package #6504

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
ZRunner opened this issue May 14, 2019 · 6 comments
Closed
Labels
auto-locked Outdated issues that have been locked by automation OS: macos MacOS specific type: support User Support

Comments

@ZRunner
Copy link

ZRunner commented May 14, 2019

Environment

  • pip version: 19.0.1 or 19.1.1, not sure
  • Python version: 3.7.3
  • OS: macOS Mojave (10.14.4 - 18E226)
  • Python installed with Homebrew 2.1.2

Description
I'm getting an error message when I try to use pip install/uninstall/upgrade commands, no matter what's the package is. The error is saying me pip 19.0.1 can't be found, but when I use pip -V it shows pip 19.1.1 from /usr/local/lib/python3.7/site-packages/pip (python 3.7).

I already try to uninstall python, without success. And about pip-19.0.1.dist-info mentionned in the report, this folder is completely empty. Not even hidden files.

Also when I use pip list --outdated, pip is noted as using the 19.0.1.

Expected behavior
Well, I expected no error. Sounds obvious but eh...

How to Reproduce
I didn't find how to reproduce this bug. I have no other Mac where to test and it works perfectly fine on my Debian 9 server.

  1. Get package from [any] / try to upgrade package [any]
  2. An error occurs.

Output

$ pip3 install -U pip
Collecting pip
  Using cached https://files.pythonhosted.org/packages/5c/e0/be401c003291b56efc55aeba6a80ab790d3d4cece2778288d65323009420/pip-19.1.1-py2.py3-none-any.whl
ERROR: Error checking for conflicts.
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3012, in _dep_map
    return self.__dep_map
  File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2806, in __getattr__
    raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3003, in _parsed_pkg_info
    return self._pkg_info
  File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2806, in __getattr__
    raise AttributeError(attr)
AttributeError: _pkg_info

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 524, in _warn_about_conflicts
    package_set, _dep_info = check_install_conflicts(to_install)
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/operations/check.py", line 108, in check_install_conflicts
    package_set, _ = create_package_set_from_installed()
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/operations/check.py", line 47, in create_package_set_from_installed
    package_set[name] = PackageDetails(dist.version, dist.requires())
  File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2727, in requires
    dm = self._dep_map
  File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3014, in _dep_map
    self.__dep_map = self._compute_dependencies()
  File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3023, in _compute_dependencies
    for req in self._parsed_pkg_info.get_all('Requires-Dist') or []:
  File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3005, in _parsed_pkg_info
    metadata = self.get_metadata(self.PKG_INFO)
  File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1419, in get_metadata
    value = self._get(self._fn(self.egg_info, name))
  File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1607, in _get
    with open(path, 'rb') as stream:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/runner/Library/Python/3.7/lib/python/site-packages/pip-19.0.1.dist-info/METADATA'
Installing collected packages: pip
  Found existing installation: pip 19.0.1
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: '/Users/runner/Library/Python/3.7/lib/python/site-packages/pip-19.0.1.dist-info/RECORD'
$ pip install pip
Requirement already satisfied: pip in ./Library/Python/3.7/lib/python/site-packages (19.0.1)
WARNING: No metadata found in ./Library/Python/3.7/lib/python/site-packages
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: '/Users/runner/Library/Python/3.7/lib/python/site-packages/pip-19.0.1.dist-info/METADATA'

If I forgot any info, feel free to ask.

@uranusjr
Copy link
Member

My guess (confirmation needed) is that Homebrew’s Python breaks how pip manages distributions, especially how it does in-place upgrade. If that is the case, this is likely more on Homebrew than pip (because pip can’t do much about it).

@ZRunner
Copy link
Author

ZRunner commented May 15, 2019

Ok so I should post it in the Homebrew github page?
If someone else can confirm, I'll do it. Else... well, i'm still waiting lol.

@pradyunsg pradyunsg added the S: needs triage Issues/PRs that need to be triaged label Jun 22, 2019
@chrahunt chrahunt added OS: macos MacOS specific type: support User Support labels Jul 20, 2019
@ghost ghost removed the S: needs triage Issues/PRs that need to be triaged label Jul 20, 2019
@chrahunt
Copy link
Member

@ZRunner, did you get this resolved or have any luck figuring out how to reproduce the issue?

@chrahunt chrahunt added the S: awaiting response Waiting for a response/more information label Jul 20, 2019
@ZRunner
Copy link
Author

ZRunner commented Jul 20, 2019

Yeah sorry I thought this issue was closed... so no I didn’t find a way to reproduce it, but I have some ideas. I think it was because I didn’t properly delete the old python version (installed with the website) before downloading the brew-version.
So what I did a few days ago was to completely remove every python file in the whole computer, then download again latest python with brew, and it seems that everything works fine now.

Probably nothing that pip can do, except maybe add a security for this kind of case (clear useless folders to avoid confusion, or idk what). Thanks for the reply, and my apologies for the lack of answer :/

@no-response no-response bot removed the S: awaiting response Waiting for a response/more information label Jul 20, 2019
@chrahunt
Copy link
Member

No worries! I'm glad that you were able to get unblocked. I think we're considering a few options in #6251 to address this situation (invalid .dist-info directories), so I will close this. Please let us know if you have any other problems or suggestions.

@ctivanovich
Copy link

ctivanovich commented Aug 8, 2019

I'm having this issue as well, albeit with WSL within an anaconda base environment: FileNotFoundError: [Errno 2] No such file or directory: '/home/wsl/anaconda3/lib/python3.7/site-packages/jupyter-1.0.0.dist-info/METADATA whenever I install something with pip. So I guess pip is looking for this folder to read distro information, and doesn't know where else to look to check for conflicts? The installations go through even with this error, so probably I am at high risk of having major conflicts? Or perhaps I can count on conda to resolve conflicts whenever I do updates with it?

Here is the error in its entirety:

ERROR: Error checking for conflicts.
Traceback (most recent call last):
  File "/home/wsl/anaconda3/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3012, in _dep_map
    return self.__dep_map
  File "/home/wsl/anaconda3/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2806, in __getattr__
    raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wsl/anaconda3/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3003, in _parsed_pkg_info
    return self._pkg_info
  File "/home/wsl/anaconda3/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2806, in __getattr__
    raise AttributeError(attr)
AttributeError: _pkg_info

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wsl/anaconda3/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 524, in _warn_about_conflicts
    package_set, _dep_info = check_install_conflicts(to_install)
  File "/home/wsl/anaconda3/lib/python3.7/site-packages/pip/_internal/operations/check.py", line 108, in check_install_conflicts
    package_set, _ = create_package_set_from_installed()
  File "/home/wsl/anaconda3/lib/python3.7/site-packages/pip/_internal/operations/check.py", line 47, in create_package_set_from_installed
    package_set[name] = PackageDetails(dist.version, dist.requires())
  File "/home/wsl/anaconda3/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2727, in requires
    dm = self._dep_map
  File "/home/wsl/anaconda3/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3014, in _dep_map
    self.__dep_map = self._compute_dependencies()
  File "/home/wsl/anaconda3/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3023, in _compute_dependencies
    for req in self._parsed_pkg_info.get_all('Requires-Dist') or []:
  File "/home/wsl/anaconda3/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3005, in _parsed_pkg_info
    metadata = self.get_metadata(self.PKG_INFO)
  File "/home/wsl/anaconda3/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1419, in get_metadata
    value = self._get(self._fn(self.egg_info, name))
  File "/home/wsl/anaconda3/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1607, in _get
    with open(path, 'rb') as stream:
FileNotFoundError: [Errno 2] No such file or directory: '/home/wsl/anaconda3/lib/python3.7/site-packages/jupyter-1.0.0.dist-info/METADATA'

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Sep 7, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Sep 7, 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 OS: macos MacOS specific type: support User Support
Projects
None yet
Development

No branches or pull requests

5 participants