pip: 'METADATA' crash during 'pip install'

  • pip version:20.2
  • Python version:3.8.4
  • Operating system:windows 10
C:\Users\elcot>pip install scipy
Requirement already satisfied: scipy in c:\users\elcot\appdata\local\programs\python\python38\lib\site-packages (1.4.1)
Requirement already satisfied: numpy>=1.13.3 in c:\users\elcot\appdata\roaming\python\python38\site-packages (from scipy) (1.19.0)
ERROR: Error while checking for conflicts. Please file an issue on pip's issue tracker: https://github.com/pypa/pip/issues/new
Traceback (most recent call last):
  File "c:\users\elcot\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3021, in _dep_map
    return self.__dep_map
  File "c:\users\elcot\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2815, in __getattr__
    raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\elcot\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3012, in _parsed_pkg_info
    return self._pkg_info
  File "c:\users\elcot\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2815, in __getattr__
    raise AttributeError(attr)
AttributeError: _pkg_info

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\elcot\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\commands\install.py", line 535, in _determine_conflicts
    return check_install_conflicts(to_install)
  File "c:\users\elcot\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\operations\check.py", line 108, in check_install_conflicts
    package_set, _ = create_package_set_from_installed()
  File "c:\users\elcot\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\operations\check.py", line 50, in create_package_set_from_installed
    package_set[name] = PackageDetails(dist.version, dist.requires())
  File "c:\users\elcot\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2736, in requires
    dm = self._dep_map
  File "c:\users\elcot\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3023, in _dep_map
    self.__dep_map = self._compute_dependencies()
  File "c:\users\elcot\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3032, in _compute_dependencies
    for req in self._parsed_pkg_info.get_all('Requires-Dist') or []:
  File "c:\users\elcot\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3014, in _parsed_pkg_info
    metadata = self.get_metadata(self.PKG_INFO)
  File "c:\users\elcot\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 1420, in get_metadata
    value = self._get(path)
  File "c:\users\elcot\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 1616, in _get
    with open(path, 'rb') as stream:
PermissionError: [Errno 13] Permission denied: 'c:\\users\\elcot\\appdata\\roaming\\python\\python38\\site-packages\\astroid-2.4.2.dist-info\\METADATA'

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 30 (17 by maintainers)

Commits related to this issue

Most upvoted comments

Here’s some context for people landing in this issue. The error is generated during the “integrity check” phase after packages are installed, and the fact that you hit this indicates that the packages you want have all been correctly installed. You can safely ignore this message if you must.

The easiest way to work around the error is to delete the offending .dist-info directory in your environment. The last line of the error message should contain something like

FileNotFoundError: No such file or directory: /some/path/to/package-version.dist-info/METADATA

Steps to recover:

  • Delete the displayed package-version.dist-info directory
  • pip install --force-reinstall package==version

Update: The most likely cause to this issue is you installed the offending package with pip, but than uninstalled it with conda. This has been reported in conda/conda#10357; please drop a word there to let Conda maintainers know this is an issue.

This is released as part of pip 20.2.4 now. Upgrading to the newest pip will include the fix.

What does this mean? How do I get the fixed version of pip and install it?

You can either wait for the next official release of pip, and upgrade when it’s out, or you can install pip from github if you’re comfortable doing that (python -m pip install --upgrade git+https://github.com/pypa/pip, but be aware that you are getting the “work in progress” unreleased version of pip).

It’s 2021, I’m having the same problem. I have tried both pip and conda but didn’t get lots of luck.

I have this error on arch GNU/Linux doing pip install salt

 pip3 install salt
Defaulting to user installation because normal site-packages is not writeable
Processing ./.cache/pip/wheels/a7/12/bc/b4f43921fe4940f3fa5bf478951dea3fb4add1f79033a9e73e/salt-3001.1-py3-none-any.whl
Requirement already satisfied: distro in /usr/lib/python3.8/site-packages (from salt) (1.5.0)
Requirement already satisfied: requests>=1.0.0 in /usr/lib/python3.8/site-packages (from salt) (2.24.0)
Requirement already satisfied: pycryptodomex>=3.9.7 in /usr/lib/python3.8/site-packages (from salt) (3.9.7)
Requirement already satisfied: msgpack!=0.5.5,>=0.5 in /usr/lib/python3.8/site-packages (from salt) (1.0.0)
Requirement already satisfied: pyzmq>=17.0.0 in /usr/lib/python3.8/site-packages (from salt) (19.0.1)
Requirement already satisfied: Jinja2 in /usr/lib/python3.8/site-packages (from salt) (2.11.2)
Requirement already satisfied: PyYAML in /usr/lib/python3.8/site-packages (from salt) (5.3.1)
Requirement already satisfied: MarkupSafe in /usr/lib/python3.8/site-packages (from salt) (1.1.1)
Requirement already satisfied: chardet>=3.0.2 in /usr/lib/python3.8/site-packages (from requests>=1.0.0->salt) (3.0.4)
Requirement already satisfied: idna>=2.5 in /usr/lib/python3.8/site-packages (from requests>=1.0.0->salt) (2.10)
Requirement already satisfied: urllib3>=1.21.1 in /usr/lib/python3.8/site-packages (from requests>=1.0.0->salt) (1.25.10)
ERROR: Error checking for conflicts.
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2720, in _dep_map
    return self.__dep_map
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2835, in __getattr__
    raise AttributeError(attr)
AttributeError: _Distribution__dep_map

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/packaging/requirements.py", line 98, in __init__
    req = REQUIREMENT.parseString(requirement_string)
  File "/usr/lib/python3.8/site-packages/pyparsing.py", line 1955, in parseString
    raise exc
  File "/usr/lib/python3.8/site-packages/pyparsing.py", line 3814, in parseImpl
    raise ParseException(instring, loc, self.errmsg, self)
pyparsing.ParseException: Expected stringEnd, found ','  (at char 1), (line:1, col:2)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 512, in _warn_about_conflicts
    package_set, _dep_info = check_install_conflicts(to_install)
  File "/usr/lib/python3.8/site-packages/pip/_internal/operations/check.py", line 114, in check_install_conflicts
    package_set, _ = create_package_set_from_installed()
  File "/usr/lib/python3.8/site-packages/pip/_internal/operations/check.py", line 53, in create_package_set_from_installed
    package_set[name] = PackageDetails(dist.version, dist.requires())
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2756, in requires
    dm = self._dep_map
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2722, in _dep_map
    self.__dep_map = self._filter_extras(self._build_dep_map())
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2751, in _build_dep_map
    dm.setdefault(extra, []).extend(parse_requirements(reqs))
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3109, in parse_requirements
    yield Requirement(line)
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3119, in __init__
    super(Requirement, self).__init__(requirement_string)
  File "/usr/lib/python3.8/site-packages/packaging/requirements.py", line 100, in __init__
    raise InvalidRequirement(
packaging.requirements.InvalidRequirement: Parse error at "','": Expected stringEnd
Installing collected packages: salt
PermissionError: [Errno 13] Permission denied:
'c:\\users\\elcot\\appdata\\roaming\\python\\python38\\site-packages\\astroid-2.4.2.dist-info\\METADATA'

Are you able to open this file by hand in Notepad.exe (or any other editor)? It seems weird that this file cannot be read; this may be an environment issue, not a pip bug (although we should catch it and improve the error message).