You are not logged in.

#1 2025-04-16 11:06:52

swdmnd
Member
Registered: 2025-04-16
Posts: 3

[SOLVED] Kubectl gives python error on metadata "prompt_toolkit"

When I run any kubectl command (i.e.: kubectl version) it gives:

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
Client Version: v1.32.3
Kustomize Version: v5.5.0
Unable to connect to the server: getting credentials: exec: executable aws failed with exit code 1

but when I use python console it does not produce error

Python 3.13.2 (main, Feb  5 2025, 08:05:21) [GCC 14.2.1 20250128] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import importlib.metadata
>>> importlib.metadata.distribution("prompt_toolkit").version
'3.0.51'
>>> importlib.metadata.distribution("prompt_toolkit")
<importlib.metadata.PathDistribution object at 0x7e4f02370cd0>
>>> 

What I've tried but to no avail:
1. Reinstall kubectl

sudo pacman -Syu kubectl

2. Reinstall aws-cli-v2 from AUR

sudo aura -Axc aws-cli-v2

3. Reinstall python

sudo pacman -Syu python

Last edited by swdmnd (2025-04-17 02:45:29)

Offline

#2 2025-04-16 11:46:54

swdmnd
Member
Registered: 2025-04-16
Posts: 3

Re: [SOLVED] Kubectl gives python error on metadata "prompt_toolkit"

I uninstall aws-cli-v2 from AUR, unable to reinstall (got the same error) and now use the one from official git here.

The problem goes away for now. Does anyone know what's wrong?

Offline

#3 2025-04-16 12:25:32

kjozsa
Member
Registered: 2008-06-05
Posts: 163

Re: [SOLVED] Kubectl gives python error on metadata "prompt_toolkit"

I have the same issue on my daily updated Arch, solved it the same way for now.

Offline

#4 2025-04-16 14:13:22

cwl2
Member
From: Paris, France
Registered: 2025-04-16
Posts: 1
Website

Re: [SOLVED] Kubectl gives python error on metadata "prompt_toolkit"

Alternatively, downgrade python-prompt_toolkit to 3.0.50-1. Even the Arch package for 3.0.51 has to use a venv to fix that issue.

Offline

#5 2025-04-17 02:45:03

swdmnd
Member
Registered: 2025-04-16
Posts: 3

Re: [SOLVED] Kubectl gives python error on metadata "prompt_toolkit"

cwl2 wrote:

Alternatively, downgrade python-prompt_toolkit to 3.0.50-1. Even the Arch package for 3.0.51 has to use a venv to fix that issue.

This should fix it for now. I'll mark this topic solved.

Offline

#6 2025-04-18 20:31:51

rendering1561
Member
Registered: 2025-04-18
Posts: 1

Re: [SOLVED] Kubectl gives python error on metadata "prompt_toolkit"

For the lazy:
```
sudo pacman -U /var/cache/pacman/pkg/python-prompt_toolkit-3.0.50-1-any.pkg.tar.zst
```

Offline

#7 2025-04-24 17:21:35

hron84
Member
Registered: 2024-11-06
Posts: 2

Re: [SOLVED] Kubectl gives python error on metadata "prompt_toolkit"

If nothing works above (as for me, downgrading the prompt_toolkit python package did not solved the compilation problems), for AWS CLI, there is an aws-cli-bin package in AUR, built from official AWS CLI binary provided by Amazon, and despite its name, it is a v2 AWS CLI so all new functions will work.

Offline

#8 2025-05-06 00:25:08

shtrom
Member
Registered: 2009-06-10
Posts: 9
Website

Re: [SOLVED] Kubectl gives python error on metadata "prompt_toolkit"

There's a python-prompt-toolkit in AUR that seems to be pinned to 3.0.50 https://cloud.google.com/storage/docs/a … th-helpers

Adding a `provides=("python-prompt_toolkit")` (might be worth adding a `conflicts`, too) to the PKGBUILD allows to build and re-install aws-cli-v2 without pulling python-prompt_toolkit-3.0.51 from the official repos.

Offline

Board footer

Powered by FluxBB