prompt-toolkit / prompt-toolkit/python-prompt-toolkit

When using AWS CLI v2: importlib.metadata.PackageNotFoundError: No package metadata was found for prompt_toolkit

Open
#1,988 7 comments 19 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.6k
Forks
815
PR merge metrics
No merged PRs in 30d

Description

See https://github.com/aws/aws-cli/issues/9453

I don't know if the root cause of this issue is on the aws-cli-v2 side or on the python-prompt_toolkit side, so I thought it would be good to raise it over here too.

$ aws sts get-caller-identity --profile REDACTED
{
    "UserId": "REDACTED",
    "Account": "REDACTED",
    "Arn": "arn:aws:sts::REDACTED:assumed-role/REDACTED"
}

$ yay -Syu
...
Packages (1) python-prompt_toolkit-3.0.51-1

Total Installed Size:  4.40 MiB
Net Upgrade Size:      0.00 MiB
...

$ aws sts get-caller-identity --profile REDACTED
Traceback (most recent call last):
  File "/usr/lib/python3.13/importlib/metadata/__init__.py", line 407, in from_name
    return next(iter(cls.discover(name=name)))
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/aws", line 19, in <module>
    import awscli.clidriver
  File "/usr/lib/python3.13/site-packages/awscli/clidriver.py", line 52, in <module>
    from awscli.autoprompt.core import AutoPromptDriver
  File "/usr/lib/python3.13/site-packages/awscli/autoprompt/core.py", line 17, in <module>
    from awscli.autoprompt.prompttoolkit import PromptToolkitPrompter
  File "/usr/lib/python3.13/site-packages/awscli/autoprompt/prompttoolkit.py", line 18, in <module>
    from prompt_toolkit.application import Application
  File "/usr/lib/python3.13/site-packages/prompt_toolkit/__init__.py", line 32, in <module>
    __version__ = metadata.version("prompt_toolkit")
  File "/usr/lib/python3.13/importlib/metadata/__init__.py", line 987, in version
    return distribution(distribution_name).version
           ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/importlib/metadata/__init__.py", line 960, in distribution
    return Distribution.from_name(distribution_name)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/importlib/metadata/__init__.py", line 409, in from_name
    raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: No package metadata was found for prompt_toolkit

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with prompt_toolkit/init.py and the traceback's metadata.version call, then inspect how python-prompt_toolkit-3.0.51-1 provides package metadata alongside the AWS CLI import path. Reproduce the failure with aws sts get-caller-identity after the upgrade; done means the command imports successfully without PackageNotFoundError and the affected package or integration is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
build-system, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.