Added a workaround for the issue with prompt_toolkit v3.0.51-1. Thanks to @project0 for providing the patch here: https://aur.archlinux.org/packages/aws-cli-v2#comment-1025124
Related upstream project issues:
Git Clone URL: | https://aur.archlinux.org/aws-cli-v2.git (read-only, click to copy) |
---|---|
Package Base: | aws-cli-v2 |
Description: | Unified command line interface for Amazon Web Services (version 2) |
Upstream URL: | https://github.com/aws/aws-cli/tree/v2 |
Licenses: | Apache-2.0 |
Conflicts: | aws-cli |
Provides: | aws-cli |
Submitter: | jelly |
Maintainer: | kstolp |
Last Packager: | kstolp |
Votes: | 48 |
Popularity: | 6.74 |
First Submitted: | 2024-04-21 11:04 (UTC) |
Last Updated: | 2025-05-31 07:17 (UTC) |
Added a workaround for the issue with prompt_toolkit v3.0.51-1. Thanks to @project0 for providing the patch here: https://aur.archlinux.org/packages/aws-cli-v2#comment-1025124
Related upstream project issues:
@kstolp this is the patch, seems to work fine in my case.
@TTimo i dont think its a problem with the upstream repo, the aws cli is just doing some incompatible things in the background. It has to be fixed by the aws-cli maintainers.
--- awscli/autoprompt/prompttoolkit.py 2025-04-25 20:05:42.000000000 +0200
+++ awscli/autoprompt/prompttoolkit.py 2025-05-12 18:22:21.449461488 +0200
@@ -15,6 +15,19 @@
import sys
from contextlib import contextmanager, nullcontext
+import importlib.metadata
+
+# Patch metadata.version to prevent crash due to missing dist-info
+real_metadata_version = importlib.metadata.version
+
+def safe_version(name):
+ if name == "prompt_toolkit":
+ return "0.0.0" # dummy version
+ return real_metadata_version(name)
+
+importlib.metadata.version = safe_version
+
+
from prompt_toolkit.application import Application
from prompt_toolkit.completion import Completer, Completion, ThreadedCompleter
from prompt_toolkit.document import Document
@kstolp the problem is with the python prompt_toolkit package, not directly this AUR. See https://github.com/prompt-toolkit/python-prompt-toolkit/issues/1988 - in particular this comment explains how to download, build and install the previous version: https://github.com/prompt-toolkit/python-prompt-toolkit/issues/1988#issuecomment-2827704607
@project0 Do you mind formatting your suggestion as a patch to this repo?
Can we add a patch to fix the import?
This seems to work for me:
from contextlib import contextmanager, nullcontext
import importlib.metadata
# Patch metadata.version to prevent crash due to missing dist-info
real_metadata_version = importlib.metadata.version
def safe_version(name):
if name == "prompt_toolkit":
return "0.0.0" # dummy version
return real_metadata_version(name)
importlib.metadata.version = safe_version
from prompt_toolkit.application import Application
from prompt_toolkit.completion import Completer, Completion, ThreadedCompleter
from prompt_toolkit.document import Document
Needed to run downgrade on python-prompt_toolkit to 3.0.50
The workaround proposed in https://github.com/aws/aws-cli/issues/9453#issuecomment-2818611814 worked for me:
sudo pacman -U /var/cache/pacman/pkg/python-prompt_toolkit-3.0.50-1-any.pkg.tar.zst
Latest version seems to be failing to install:
...Sorry, NVM, I see, need to downgrade prompt_toolkit. Did not see the similar stack trace below, wrongfully assumed it is new.
Pinned Comments
kstolp commented on 2024-10-23 05:14 (UTC)
If you receive this error when trying to build, it is because you have not imported the GPG keys used for verification.
You have two options:
1) Import the key into your keyring. ArchWiki article. The key is available in this repo, which is copied from the AWS documentation. e.g.
gpg --import keys/pgp/FB5DB77FD5C118B80511ADA8A6310ACC4672475C.asc
. (recommended)2) Alternatively, you can skip this verification by passing the
--skippgpcheck
argument tomakepkg
when building. (not recommended)