question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ZRunnercommented, 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 😕

0reactions
ctivanovichcommented, 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'
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix Python `No such file or directory` Compiler Errors ...
Introduction. A common error that you may receive when installing Python modules is the No such file or directory error.
Read more >
Yarn install command error No such file or directory: 'install'
The reason for the No such file or directory error from yarn install is that you are not using the "correct" Yarn: the...
Read more >
apt upgrade: Failed to execute operation: No such file or ...
Try running apt-get -f install and edit your question to include the output if it fails. – dobey · 1. The line dpkg:...
Read more >
Could not install packages due to an EnvironmentError: [Errno ...
The error "Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory" is caused by having a long...
Read more >
When trying to install fn package failed due to IOError: [Errno 2 ...
sudo pip install --upgrade fn_utilities-1.0.3.zip ... IOError: [Errno 2] No such file or directory: '/tmp/pip-req-build-gdZXuU/setup.py'
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found