prompt-toolkit/python-prompt-toolkit

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

Opened this issue · 7 comments

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

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

It's going to be this commit
68e3c39

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

For the fellow arch users, you can downgrade the package via:

git clone  https://gitlab.archlinux.org/archlinux/packaging/packages/python-prompt_toolkit.git
# cd to dir
git checkout 3.0.50-1
makepg
sudo pacman -U python-prompt_toolkit-3.0.50-1-any.pkg.tar.zst

For the fellow arch users, you can downgrade the package via:

git clone  https://gitlab.archlinux.org/archlinux/packaging/packages/python-prompt_toolkit.git
# cd to dir
git checkout 3.0.50-1
makepg
sudo pacman -U python-prompt_toolkit-3.0.50-1-any.pkg.tar.zst

makepkg not makepg

For the fellow arch users, you can downgrade the package via:

git clone  https://gitlab.archlinux.org/archlinux/packaging/packages/python-prompt_toolkit.git
# cd to dir
git checkout 3.0.50-1
makepg
sudo pacman -U python-prompt_toolkit-3.0.50-1-any.pkg.tar.zst

hola!, funcionó perfect, si sale algo de errores de dependencias ejecutar

yay -S python-setuptools

I'm trying to update prompt-toolkit in Fedora Linux, and I have exactly the same problem – tests of awscli2 fail with the same traceback.