Skip to content
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

KeyError: 'No metadata except PKG-INFO is available' #11361

Open
tangculiji0612 opened this issue Aug 8, 2022 · 5 comments
Open

KeyError: 'No metadata except PKG-INFO is available' #11361

tangculiji0612 opened this issue Aug 8, 2022 · 5 comments
Labels
S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior

Comments

@tangculiji0612
Copy link

tangculiji0612 commented Aug 8, 2022

Description

I made an error when executing the PIP install command:

root@ubuntu:~# pip install sympy
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple, https://pypi.ngc.nvidia.com
Collecting sympy
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d0/04/66be21ceb305c66a4b326b0ae44cc4f027a43bc08cac204b48fb45bb3653/sympy-1.10.1-py3-none-any.whl (6.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.4/6.4 MB 2.1 MB/s eta 0:00:00
Requirement already satisfied: mpmath>=0.19 in /usr/local/python3.7.5/lib/python3.7/site-packages (from sympy) (1.2.1)
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 "/usr/local/python3.7.5/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3021, in _dep_map
    return self.__dep_map
  File "/usr/local/python3.7.5/lib/python3.7/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 "/usr/local/python3.7.5/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3012, in _parsed_pkg_info
    return self._pkg_info
  File "/usr/local/python3.7.5/lib/python3.7/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 "/usr/local/python3.7.5/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 585, in _determine_conflicts
    return check_install_conflicts(to_install)
  File "/usr/local/python3.7.5/lib/python3.7/site-packages/pip/_internal/operations/check.py", line 101, in check_install_conflicts
    package_set, _ = create_package_set_from_installed()
  File "/usr/local/python3.7.5/lib/python3.7/site-packages/pip/_internal/operations/check.py", line 42, in create_package_set_from_installed
    dependencies = list(dist.iter_dependencies())
  File "/usr/local/python3.7.5/lib/python3.7/site-packages/pip/_internal/metadata/pkg_resources.py", line 199, in iter_dependencies
    return self._dist.requires(extras)
  File "/usr/local/python3.7.5/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2736, in requires
    dm = self._dep_map
  File "/usr/local/python3.7.5/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3023, in _dep_map
    self.__dep_map = self._compute_dependencies()
  File "/usr/local/python3.7.5/lib/python3.7/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 "/usr/local/python3.7.5/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3014, in _parsed_pkg_info
    metadata = self.get_metadata(self.PKG_INFO)
  File "/usr/local/python3.7.5/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1895, in get_metadata
    raise KeyError("No metadata except PKG-INFO is available")
KeyError: 'No metadata except PKG-INFO is available'

What needs to be done

What shall I do?

Guidance for potential contributors

This issue is a good starting point for first time contributors -- the process of fixing this should be a good introduction to pip's development workflow. If there is not a corresponding pull request for this issue, it is up for grabs. For directions for getting set up, see our Getting Started Guide. If you are working on this issue and have questions, feel free to ask them here. If you've contributed code to pip before, we encourage you to pick up an issue without this label.

@tangculiji0612 tangculiji0612 added the good first issue A good item for first time contributors to work on label Aug 8, 2022
@ArshErgon
Copy link

does this error happen when you try to install any other library other than your current one?
Could you try to uninstall python and reinstall it?

@domdfcoding
Copy link
Contributor

It looks like you're trying to install the package globally (which generally isn't a good idea). Can you try installing into a virtual environment (see the guide here if you're unsure) to see if the problem persists.

@shanmukh9
Copy link

can you try to upgrade your pip to pip3 and try?

@DiddiLeija DiddiLeija added type: bug A confirmed bug or unintended behavior S: needs triage Issues/PRs that need to be triaged and removed good first issue A good item for first time contributors to work on labels Aug 8, 2022
@zhuofeng6
Copy link

what is your pip version?

@leondgarse
Copy link

leondgarse commented Sep 5, 2022

I came across this issue today, and my pip version is pip 22.2.2. For me it's any pip command like pip show numpy also throwing this error. My solution is:

  • Modify the error line /usr/local/python3.7.5/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py 1895 adding the actual problem file to log:
    vi /usr/local/python3.7.5/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py +1895
    -         raise KeyError("No metadata except PKG-INFO is available")
    +         raise KeyError("No metadata except PKG-INFO is available: {}".format(self.path))
  • Then run again and check if the printed xxx.dist-info file valid. For mine it's caused by a broken soft link. Remove or rename that and try again.
  • You may also try if PYTHONPATH='' pip install sympy works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

No branches or pull requests

7 participants