Skip to content

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

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

Open
evanstucker-hates-2fa opened this issue Apr 21, 2025 · 3 comments

Comments

@evanstucker-hates-2fa
Copy link

See aws/aws-cli#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
@evanstucker-hates-2fa
Copy link
Author

Temporary workaround for people using Arch who still have the previous package cached - downgrade python-prompt_toolkit:

sudo pacman -U /var/cache/pacman/pkg/python-prompt_toolkit-3.0.50-1-any.pkg.tar.zst

@prochac
Copy link

prochac commented Apr 21, 2025

It's going to be this commit
68e3c39

@steven-esser
Copy link

Experiencing this as well (I do not use Arch btw).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants