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.

FileNotFoundError: [Errno 2] No such file or directory: '/home/user/anaconda3/lib/python3.6/site-packages/psutil-5.4.8.dist-info/METADATA'

See original GitHub issue

Environment

  • pip version: 19.0.2
  • Python version: 3.6
  • OS: Linux Mint 19.1 (Linux 4.15.0-45-generic x86_64)
  • conda 4.6.2

Description When running Jupyter Notebook, following error prevented kernel starting:

ModuleNotFoundError: No module named 'prompt_toolkit.formatted_text'

Based on this, I tried to pip install -U jupyter_console. This failed, giving

FileNotFoundError: [Errno 2] No such file or directory: '/home/user/anaconda3/lib/python3.6/site-packages/psutil-5.4.8.dist-info/METADATA'

Upon further investigation, the reason for this is that there was as subfolder created with another psutil-5.4.8.dist-info created. Thus, by moving the files out of this nested subfolder, everything worked again.

KO: /home/user/anaconda3/lib/python3.6/site-packages/psutil-5.4.8.dist-info/psutil-5.4.8.dist-info/METADATA

OK: /home/user/anaconda3/lib/python3.6/site-packages/psutil-5.4.8.dist-info/METADATA

I wasn’t manually doing anything in these package folders; any idea what automatic process (suspect pip-related) could have caused this?

Expected behavior Directory structure should be /home/user/anaconda3/lib/python3.6/site-packages/psutil-5.4.8.dist-info/METADATA

How to Reproduce pip install -U jupyter_console

Output

Error checking for conflicts.
Traceback (most recent call last):
  File "/home/jwfu/anaconda3/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2897, in _dep_map
    return self.__dep_map
  File "/home/jwfu/anaconda3/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2691, 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/jwfu/anaconda3/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2888, in _parsed_pkg_info
    return self._pkg_info
  File "/home/jwfu/anaconda3/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2691, in __getattr__
    raise AttributeError(attr)
AttributeError: _pkg_info

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/jwfu/anaconda3/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 503, in _warn_about_conflicts
    package_set, _dep_info = check_install_conflicts(to_install)
  File "/home/jwfu/anaconda3/lib/python3.6/site-packages/pip/_internal/operations/check.py", line 108, in check_install_conflicts
    package_set, _ = create_package_set_from_installed()
  File "/home/jwfu/anaconda3/lib/python3.6/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/jwfu/anaconda3/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2635, in requires
    dm = self._dep_map
  File "/home/jwfu/anaconda3/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2899, in _dep_map
    self.__dep_map = self._compute_dependencies()
  File "/home/jwfu/anaconda3/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2908, in _compute_dependencies
    for req in self._parsed_pkg_info.get_all('Requires-Dist') or []:
  File "/home/jwfu/anaconda3/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2890, in _parsed_pkg_info
    metadata = self.get_metadata(self.PKG_INFO)
  File "/home/jwfu/anaconda3/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1410, in get_metadata
    value = self._get(self._fn(self.egg_info, name))
  File "/home/jwfu/anaconda3/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1522, in _get
    with open(path, 'rb') as stream:
FileNotFoundError: [Errno 2] No such file or directory: '/home/jwfu/anaconda3/lib/python3.6/site-packages/psutil-5.4.8.dist-info/METADATA'

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:17 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
giacomoarienticommented, Feb 14, 2020

I solved my problem in this way: conda uninstall pip

Now pip works fine but I had to reinstall all my packages.

2reactions
yuvirlcommented, Nov 27, 2019

I solved the problem in this way.

pip install -U pip pip install psutil

Read more comments on GitHub >

github_iconTop Results From Across the Web

FileNotFoundError: [Errno 2] No such file or directory [duplicate]
The error is telling you that there is no file of that name in the working directory. Try using the exact, or absolute,...
Read more >
Python FileNotFoundError: [Errno 2] No such file or directory ...
This error tells you that you are trying to access a file or folder that does not exist. To fix this error, check...
Read more >
FileNotFoundError: [Errno 2] No such ... - Net-Informations.Com
No such file or directory " is telling you that there is no file of that name in the working directory. So, try...
Read more >
FileNotFoundError: [Errno 2] No such file or directory
To solve the error, move the file to the directory where the Python script is located if using a local path, or use...
Read more >
How to fix FileNotFoundError Errno 2 no such file or directory
The error FileNotFoundError Errno 2 no such file or directory occurs when Python cannot find the specified file in the current directory. ·...
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