myagent-ai 1.15.63 → 1.15.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/start.js +33 -4
package/package.json
CHANGED
package/start.js
CHANGED
|
@@ -171,7 +171,7 @@ function pipInstall(venvPython, pkgSpec, quiet) {
|
|
|
171
171
|
for (const getMirror of MIRRORS) {
|
|
172
172
|
try {
|
|
173
173
|
const mirrorArgs = getMirror();
|
|
174
|
-
const args = ["-m", "pip", "install", "--disable-pip-version-check"];
|
|
174
|
+
const args = ["-m", "pip", "install", "--disable-pip-version-check", "--prefer-binary"];
|
|
175
175
|
if (mirrorArgs.length) args.push(...mirrorArgs);
|
|
176
176
|
if (quiet) args.push("-q");
|
|
177
177
|
args.push(pkgSpec);
|
|
@@ -180,7 +180,6 @@ function pipInstall(venvPython, pkgSpec, quiet) {
|
|
|
180
180
|
});
|
|
181
181
|
return { ok: true, err: "" };
|
|
182
182
|
} catch (e) {
|
|
183
|
-
// 保留最后 5 行 stderr 作为错误信息
|
|
184
183
|
const raw = (e.stderr || "");
|
|
185
184
|
lastErr = raw.trim().split("\n").slice(-5).join("\n").trim() || e.message || "unknown error";
|
|
186
185
|
}
|
|
@@ -188,6 +187,35 @@ function pipInstall(venvPython, pkgSpec, quiet) {
|
|
|
188
187
|
return { ok: false, err: lastErr };
|
|
189
188
|
}
|
|
190
189
|
|
|
190
|
+
/**
|
|
191
|
+
* 尝试安装包(带依赖),如果失败则尝试 --no-deps(裸装)
|
|
192
|
+
* 用于处理 openai→jiter 这类"主包能装但子依赖编译失败"的情况
|
|
193
|
+
*/
|
|
194
|
+
function pipInstallWithFallback(venvPython, pkgSpec, quiet) {
|
|
195
|
+
// 正常安装
|
|
196
|
+
const r1 = pipInstall(venvPython, pkgSpec, quiet);
|
|
197
|
+
if (r1.ok) return r1;
|
|
198
|
+
|
|
199
|
+
// 回退: --no-deps 安装主包,跳过编译失败的子依赖
|
|
200
|
+
for (const getMirror of MIRRORS) {
|
|
201
|
+
try {
|
|
202
|
+
const mirrorArgs = getMirror();
|
|
203
|
+
const args = ["-m", "pip", "install", "--disable-pip-version-check", "--prefer-binary", "--no-deps"];
|
|
204
|
+
if (mirrorArgs.length) args.push(...mirrorArgs);
|
|
205
|
+
if (quiet) args.push("-q");
|
|
206
|
+
args.push(pkgSpec);
|
|
207
|
+
execFileSync(venvPython, args, {
|
|
208
|
+
encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 180000,
|
|
209
|
+
});
|
|
210
|
+
return { ok: true, err: "(--no-deps)" };
|
|
211
|
+
} catch (e) {
|
|
212
|
+
const raw = (e.stderr || "");
|
|
213
|
+
lastErr = raw.trim().split("\n").slice(-5).join("\n").trim() || e.message || "unknown error";
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return r1;
|
|
217
|
+
}
|
|
218
|
+
|
|
191
219
|
/**
|
|
192
220
|
* 从 requirements.txt 解析包列表
|
|
193
221
|
* @returns {string[]} 如 ["openai>=1.12.0", "aiohttp>=3.9.0", ...]
|
|
@@ -268,9 +296,10 @@ function installAllDeps(venvPython, pkgDir) {
|
|
|
268
296
|
const isCore = CORE_DEPS.includes(baseName);
|
|
269
297
|
process.stdout.write(` [${idx}/${total}] ${pkg} ... `);
|
|
270
298
|
|
|
271
|
-
const result = pipInstall(venvPython, pkg, true);
|
|
299
|
+
const result = isCore ? pipInstallWithFallback(venvPython, pkg, true) : pipInstall(venvPython, pkg, true);
|
|
272
300
|
if (result.ok) {
|
|
273
|
-
|
|
301
|
+
const note = result.err === "(--no-deps)" ? " \x1b[33m(部分子依赖跳过)\x1b[0m" : "";
|
|
302
|
+
console.log("\x1b[32m✓\x1b[0m" + note);
|
|
274
303
|
} else {
|
|
275
304
|
if (isCore) {
|
|
276
305
|
console.log("\x1b[31m✗\x1b[0m");
|