You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[INFO] Upgrading pip using index: `https://mirrors.aliyun.com/pypi/simple`
[INFO] Installing uv using index: `https://mirrors.aliyun.com/pypi/simple`
[INFO] Installing requirements using index: `https://mirrors.aliyun.com/pypi/simple`
D:\AstrBot\venv\Scripts\python.exe: No module named uv
[WARN] requirements install failed with `https://mirrors.aliyun.com/pypi/simple.`
Retrying with `https://pypi.org/simple...`
D:\AstrBot\venv\Scripts\python.exe: No module named uv
[ERROR] Failed to install dependencies from requirements.txt.
或
uv._find_uv.UvNotFound: Could not find the uv binary in any of the following locations:
- D:\AstrBot\venv\Scripts
- C:\Users\Administrator\AppData\Local\Programs\Python\Python310\Scripts
- D:\AstrBot\venv\lib\site-packages\bin
- C:\Users\Administrator\AppData\Roaming\Python\Python310\Scripts
Found uv [astral-sh.uv] Version 0.11.3
Successfully installed
Path environment variable modified; restart your shell to use the new value.
Command line alias added: "uvx"
Command line alias added: "uv"
Command line alias added: "uvw"
This discussion was converted from issue #7412 on April 08, 2026 03:27.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
AstrBot 插件依赖安装失败:uv 工具缺失问题解决方案
📋 问题描述
在特定 Windows 环境下,安装 AstrBot 插件时出现依赖安装失败,错误码为 2。此问题与 AstrBot 核心代码无关,而是由于特定环境配置导致 AstrBot 尝试使用
uv工具安装依赖,但系统中缺少uv可执行文件。典型错误日志
或
影响范围
🔍 问题原因分析
重要说明
此问题与 AstrBot 核心代码无关。AstrBot 核心代码使用的是标准
pip进行依赖管理(详见astrbot/core/utils/pip_installer.py)。根本原因
在特定 Windows 环境下,AstrBot 会尝试使用
uv工具来安装插件依赖,而不是使用标准的pip。这可能是由于:为什么需要 uv
uv是一个高性能的 Python 包管理工具,AstrBot 在特定环境下会尝试使用它来加速依赖安装。但uv包含两部分:pip install uv安装uv.exe) - 需要单独安装仅安装 Python 模块是不够的,必须同时有可执行文件。
✅ 解决方案
方案一:使用 WinGet 安装 uv(推荐 ⭐)
WinGet 是 Windows 自带的包管理器,可以自动安装 uv 并配置环境变量。
步骤 1:安装 uv
以管理员身份打开 PowerShell 或 CMD,执行:
安装成功输出示例:
步骤 2:查找 uv 安装位置
where uv典型输出:
步骤 3:复制 uv.exe 到 AstrBot 虚拟环境
注意:请根据你的实际安装路径修改命令中的路径。
步骤 4:重启 AstrBot
关闭并重新启动 AstrBot,插件依赖安装应该能正常工作了。
方案二:手动下载 uv 可执行文件
如果 WinGet 无法使用,可以手动下载 uv。
步骤 1:下载 uv
访问 uv 的 GitHub Releases 页面:
https://github.com/astral-sh/uv/releases
下载对应系统的版本:
uv-x86_64-pc-windows-msvc.zipuv-aarch64-pc-windows-msvc.zip步骤 2:解压并复制
解压下载的 zip 文件,将
uv.exe和uvx.exe复制到 AstrBot 的虚拟环境 Scripts 目录:步骤 3:重启 AstrBot
方案三:使用 PowerShell 脚本安装 uv
🔧 验证安装
检查 uv 是否正确安装
成功输出示例:
测试插件安装
重启 AstrBot 后,尝试安装一个插件,观察是否还会出现依赖安装失败的错误。
❓ 常见问题 FAQ
Q1: 这是 AstrBot 的 bug 吗?
A: 不是。AstrBot 核心代码使用的是标准 pip(详见
astrbot/core/utils/pip_installer.py)。此问题是由特定 Windows 环境配置导致的,AstrBot 在这些环境下会尝试使用 uv 而不是 pip。Q2: 为什么 pip install uv 不够?
A:
pip install uv只安装了 Python 模块,但 AstrBot 需要调用uv.exe可执行文件。必须通过 WinGet、官方安装脚本或手动下载获取可执行文件。Q3: 复制 uv.exe 后仍然报错?
A: 请检查:
uvx.exevenv\Scripts\)Q4: 如何找到我的 AstrBot 虚拟环境路径?
A: 默认路径通常在 AstrBot 安装目录下:
或在启动 AstrBot 时查看日志中的 Python 路径。
Q5: Linux/Mac 系统会遇到此问题吗?
A: 此问题主要出现在特定 Windows 环境下。Linux/Mac 用户通常不会遇到此问题。如果遇到,可以使用以下命令安装 uv:
curl -LsSf https://astral.sh/uv/install.sh | shQ6: 如何确认 AstrBot 使用的是哪个包管理器?
A: 查看 AstrBot 启动日志,搜索
pip或uv相关日志。正常情况下 AstrBot 使用 pip,但在特定环境下会尝试使用 uv。Q7: 有没有办法让 AstrBot 不使用 uv?
A: 此问题是由环境配置导致的,不是 AstrBot 的可配置选项。如果希望 AstrBot 使用标准 pip,建议检查并清理 Python 环境配置,找出导致 AstrBot 尝试使用 uv 的原因。
🔍 环境检查建议
如果希望找出根本原因,建议检查以下内容:
1. 检查 pip 配置
2. 检查环境变量
3. 检查虚拟环境
4. 检查全局 Python 配置
检查以下位置是否有异常配置:
%APPDATA%\pip\pip.ini%LOCALAPPDATA%\pip\pip.iniC:\ProgramData\pip\pip.ini📊 环境信息
测试环境
操作系统:
硬件配置:
软件环境:
适用范围
🔗 参考链接
📝 总结
问题本质
在特定 Windows 环境下,AstrBot 会尝试使用 uv 作为包管理器,但虚拟环境中缺少 uv 的可执行文件(uv.exe),导致插件依赖安装失败。
解决核心
推荐方案
WinGet 安装是最简单可靠的方式,自动处理环境变量和路径配置。
重要提醒
此问题与 AstrBot 核心代码无关,而是由特定环境配置导致。如果希望找出根本原因,建议检查 Python 环境配置。
📚 附录:问题排查全过程记录
背景
此问题最初出现在一位用户的 Windows 电脑上,表现为使用 Launcher 或旧版 Windows 安装器部署 AstrBot 时,插件依赖安装都会失败,错误码为 2。(注:桌面端不受此 uv 问题影响)
排查过程
第一阶段:初步分析错误日志
观察到的现象:
ModuleNotFoundError: No module named 'uv'[INFO] Installing uv using index: ...初步判断:
第二阶段:尝试安装 uv
尝试 1:使用 pip 安装 uv
结果: 失败
No module named 'uv'发现:
pip install uv安装的包位于D:\Python\Lib\site-packages\uvD:\AstrBot\venv\第三阶段:手动复制 uv 到虚拟环境
尝试 2:复制 uv 模块到虚拟环境
结果: 部分成功
uv._find_uv.UvNotFound关键发现:
第四阶段:安装 uv 可执行文件
尝试 3:使用 WinGet 安装 uv
结果: 成功安装 uv 到系统
C:\uv\uv.exe尝试 4:复制 uv.exe 到虚拟环境
结果: 成功!
第五阶段:深入分析根本原因
疑问: 为什么 AstrBot 会尝试使用 uv?
调查 1:检查 AstrBot 核心代码
astrbot/core/utils/pip_installer.py调查 2:检查 requirements.txt
调查 3:检查启动脚本
main.py、runtime_bootstrap.py关键发现:
第六阶段:确认问题范围
测试: 在多个 AstrBot 部署方式上测试
方式 1:AstrBot Launcher(启动器)
[INFO] Installing uv...后No module named uv方式 2:旧版 Windows 安装器(PowerShell 脚本)- 最终使用的方案
方式 3:AstrBot 桌面端(Desktop)
插件依赖安装失败: 安装失败,错误码:2和failed to set global default subscriber结论:
关键发现总结
AstrBot 核心代码使用 pip
astrbot/core/utils/pip_installer.pyrequirements.txt中没有 uv特定环境会触发 uv 使用
解决方案有效
问题性质
版本缺陷记录
受影响版本:
缺陷描述:
在特定 Windows 环境下,AstrBot 会尝试使用 uv 工具安装插件依赖,但:
缺陷影响:
临时解决方案:
建议修复:
建议的后续行动
对于用户:
对于 AstrBot 开发者:
对于社区:
希望这个解决方案能帮助到遇到同样问题的朋友!如有疑问或更好的方案,欢迎在评论区讨论。
最后更新时间:2026-04-08
Beta Was this translation helpful? Give feedback.
All reactions