1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
From aaeb0d24a5d284b2e4ec5e7474f98e1abc5e0328 Mon Sep 17 00:00:00 2001
From: Claudia Pellegrino <claui@users.noreply.github.com>
Date: Thu, 3 Jul 2025 14:00:47 +0200
Subject: [PATCH 1/3] Arch-Linux-specific: install optdeps via pacman
---
aider/scrape.py | 42 +++++++++++++++++-------------------------
1 file changed, 17 insertions(+), 25 deletions(-)
diff --git a/aider/scrape.py b/aider/scrape.py
index 3d5cfa86..05100044 100755
--- a/aider/scrape.py
+++ b/aider/scrape.py
@@ -18,9 +18,9 @@ def check_env():
try:
from playwright.sync_api import sync_playwright
- has_pip = True
+ has_python_package = True
except ImportError:
- has_pip = False
+ has_python_package = False
try:
with sync_playwright() as p:
@@ -29,50 +29,42 @@ def check_env():
except Exception:
has_chromium = False
- return has_pip, has_chromium
+ return has_python_package, has_chromium
def has_playwright():
- has_pip, has_chromium = check_env()
- return has_pip and has_chromium
+ has_python_package, has_chromium = check_env()
+ return has_python_package and has_chromium
def install_playwright(io):
- has_pip, has_chromium = check_env()
- if has_pip and has_chromium:
+ has_python_package, has_chromium = check_env()
+ if has_python_package and has_chromium:
return True
- pip_cmd = utils.get_pip_install(["aider-chat[playwright]"])
- chromium_cmd = "-m playwright install --with-deps chromium"
- chromium_cmd = [sys.executable] + chromium_cmd.split()
-
- cmds = ""
- if not has_pip:
- cmds += " ".join(pip_cmd) + "\n"
+ packages = []
+ if not has_python_package:
+ packages.append("python-playwright")
if not has_chromium:
- cmds += " ".join(chromium_cmd) + "\n"
+ packages.append("chromium")
+ pacman_cmd = ["sudo", "pacman", "-Syu", "--asdeps", "--noconfirm", *packages]
- text = f"""For the best web scraping, install Playwright:
+ text = f"""For the best web scraping, run pacman as follows:
-{cmds}
+{" ".join(pacman_cmd)}
See {urls.enable_playwright} for more info.
"""
io.tool_output(text)
- if not io.confirm_ask("Install playwright?", default="y"):
+ if not io.confirm_ask(f"Install {" and ".join(packages)}?", default="y"):
return
- if not has_pip:
- success, output = utils.run_install(pip_cmd)
+ if packages:
+ success, output = utils.run_install(pacman_cmd)
if not success:
io.tool_error(output)
return
- success, output = utils.run_install(chromium_cmd)
- if not success:
- io.tool_error(output)
- return
-
return True
--
2.50.0
From 7eda134890b34ba945aae48480c76bb4a14cfe9d Mon Sep 17 00:00:00 2001
From: Claudia Pellegrino <claui@users.noreply.github.com>
Date: Thu, 3 Jul 2025 14:01:26 +0200
Subject: [PATCH 2/3] Arch-Linux-specific: use system Chromium
---
aider/scrape.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/aider/scrape.py b/aider/scrape.py
index 05100044..bb885daf 100755
--- a/aider/scrape.py
+++ b/aider/scrape.py
@@ -24,7 +24,7 @@ def check_env():
try:
with sync_playwright() as p:
- p.chromium.launch()
+ p.chromium.launch(executable_path="/usr/bin/chromium")
has_chromium = True
except Exception:
has_chromium = False
@@ -140,7 +140,7 @@ class Scraper:
with sync_playwright() as p:
try:
- browser = p.chromium.launch()
+ browser = p.chromium.launch(executable_path="/usr/bin/chromium")
except Exception as e:
self.playwright_available = False
self.print_error(str(e))
--
2.50.0
From d6eca11df043a79ff97cac75162626039e834f13 Mon Sep 17 00:00:00 2001
From: Claudia Pellegrino <claui@users.noreply.github.com>
Date: Thu, 3 Jul 2025 14:02:06 +0200
Subject: [PATCH 3/3] Arch-Linux-specific: install boto3 via pacman
---
aider/models.py | 6 ++----
aider/utils.py | 32 ++++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/aider/models.py b/aider/models.py
index ae76f034..27a483dd 100644
--- a/aider/models.py
+++ b/aider/models.py
@@ -21,7 +21,7 @@ from aider.dump import dump # noqa: F401
from aider.llm import litellm
from aider.openrouter import OpenRouterModelManager
from aider.sendchat import ensure_alternating_roles, sanity_check_messages
-from aider.utils import check_pip_install_extra
+from aider.utils import check_archlinux_package, check_pip_install_extra
RETRY_TIMEOUT = 60
@@ -1167,9 +1167,7 @@ def check_for_dependencies(io, model_name):
"""
# Check if this is a Bedrock model and ensure boto3 is installed
if model_name.startswith("bedrock/"):
- check_pip_install_extra(
- io, "boto3", "AWS Bedrock models require the boto3 package.", ["boto3"]
- )
+ check_archlinux_package(io, "boto3", "python-boto3")
# Check if this is a Vertex AI model and ensure google-cloud-aiplatform is installed
elif model_name.startswith("vertex_ai/"):
diff --git a/aider/utils.py b/aider/utils.py
index 834ffa19..a58fde66 100644
--- a/aider/utils.py
+++ b/aider/utils.py
@@ -332,6 +332,38 @@ def check_pip_install_extra(io, module, prompt, pip_install_cmd, self_update=Fal
print(printable_shell_command(cmd))
+def check_archlinux_package(io, module, archlinux_package):
+ if module:
+ try:
+ __import__(module)
+ return True
+ except (ImportError, ModuleNotFoundError, RuntimeError):
+ pass
+
+ cmd = ["sudo", "pacman", "-Syu", "--asdeps", "--noconfirm", archlinux_package]
+ io.tool_warning("Using this feature requires a package to be installed.")
+
+ if not io.confirm_ask("Run pacman?", default="y", subject=printable_shell_command(cmd)):
+ return
+
+ success, output = run_install(cmd)
+ if success:
+ if not module:
+ return True
+ try:
+ __import__(module)
+ return True
+ except (ImportError, ModuleNotFoundError, RuntimeError) as err:
+ io.tool_error(str(err))
+ pass
+
+ io.tool_error(output)
+
+ print()
+ print("Install failed, try running this command manually:")
+ print(printable_shell_command(cmd))
+
+
def printable_shell_command(cmd_list):
"""
Convert a list of command arguments to a properly shell-escaped string.
--
2.50.0
|