"No such file or directory" when trying to install or upgrade a package
See original GitHub issueEnvironment
- 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.
- Get package from [any] / try to upgrade package [any]
- 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.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
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 😕
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: