From d081803434f29cd4b6a2ab8a7c555a8e97669c68 Mon Sep 17 00:00:00 2001 From: Hanabi <78060373+KurobaKaitou@users.noreply.github.com> Date: Mon, 20 Oct 2025 12:28:22 +0800 Subject: [PATCH 1/9] =?UTF-8?q?chore(util):=20=E4=BC=98=E5=8C=96=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=90=AF=E5=8A=A8=E6=97=B6=E6=A3=80=E6=B5=8Bffmpeg?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E6=97=B6=E5=9C=A8=E6=9F=90=E4=BA=9B=E5=9C=BA?= =?UTF-8?q?=E6=99=AF=E4=B8=8B=E7=9A=84=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 此次变动主要针对 Linux (Ubuntu 22.04) 环境下根据官方提供的README文档以及conda安装 ffmpeg 环境后出现缺失动态库libiconv.so.2的问题 报错完整信息如下: `ffmpeg: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory` 基于以上报错信息 优化了util.py中的check_ffmpeg_installed函数 - 保留了原有命令行的提示信息 [定位问题更加友好] - 抓取报错中的 libiconv.so.2 文本内容 进行提示用户通过conda安装 libiconv 动态库 --- main/xiaozhi-server/core/utils/util.py | 69 +++++++++++++++++++------- 1 file changed, 51 insertions(+), 18 deletions(-) diff --git a/main/xiaozhi-server/core/utils/util.py b/main/xiaozhi-server/core/utils/util.py index 27471e58..ea34d3e8 100644 --- a/main/xiaozhi-server/core/utils/util.py +++ b/main/xiaozhi-server/core/utils/util.py @@ -176,31 +176,64 @@ def parse_string_to_list(value, separator=";"): return [] -def check_ffmpeg_installed(): - ffmpeg_installed = False +def check_ffmpeg_installed() -> bool: + """ + 检查当前环境中是否已正确安装并可执行 ffmpeg。 + + Returns: + bool: 如果 ffmpeg 正常可用,返回 True;否则抛出 ValueError 异常。 + + Raises: + ValueError: 当检测到 ffmpeg 未安装或依赖缺失时,抛出详细的提示信息。 + """ try: - # 执行ffmpeg -version命令,并捕获输出 + # 尝试执行 ffmpeg 命令 result = subprocess.run( ["ffmpeg", "-version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, - check=True, # 如果返回码非零则抛出异常 + check=True, # 非零退出码会触发 CalledProcessError ) - # 检查输出中是否包含版本信息(可选) - output = result.stdout + result.stderr - if "ffmpeg version" in output.lower(): - ffmpeg_installed = True - return False - except (subprocess.CalledProcessError, FileNotFoundError): - # 命令执行失败或未找到 - ffmpeg_installed = False - if not ffmpeg_installed: - error_msg = "您的电脑还没正确安装ffmpeg\n" - error_msg += "\n建议您:\n" - error_msg += "1、按照项目的安装文档,正确进入conda环境\n" - error_msg += "2、查阅安装文档,如何在conda环境中安装ffmpeg\n" - raise ValueError(error_msg) + + output = (result.stdout + result.stderr).lower() + if "ffmpeg version" in output: + return True + + # 如果未检测到版本信息,也视为异常情况 + raise ValueError("未检测到有效的 ffmpeg 版本输出。") + + except (subprocess.CalledProcessError, FileNotFoundError) as e: + # 提取错误输出 + stderr_output = "" + if isinstance(e, subprocess.CalledProcessError): + stderr_output = (e.stderr or "").strip() + else: + stderr_output = str(e).strip() + + # 构建基础错误提示 + error_msg = [ + "❌ 检测到 ffmpeg 无法正常运行。\n", + "建议您:", + "1. 确认已正确激活 conda 环境;", + "2. 查阅项目安装文档,了解如何在 conda 环境中安装 ffmpeg。\n", + ] + + # 🎯 针对具体错误信息提供额外提示 + if "libiconv.so.2" in stderr_output: + error_msg.append("⚠️ 发现缺少依赖库:libiconv.so.2") + error_msg.append("解决方法:在当前 conda 环境中执行:") + error_msg.append(" conda install -c conda-forge libiconv\n") + elif "no such file or directory" in stderr_output and "ffmpeg" in stderr_output.lower(): + error_msg.append("⚠️ 系统未找到 ffmpeg 可执行文件。") + error_msg.append("解决方法:在当前 conda 环境中执行:") + error_msg.append(" conda install -c conda-forge ffmpeg\n") + else: + error_msg.append("错误详情:") + error_msg.append(stderr_output or "未知错误。") + + # 抛出详细异常信息 + raise ValueError("\n".join(error_msg)) from e def extract_json_from_string(input_string): From bba84382ec9e8098854e5215492b103e93bd01cf Mon Sep 17 00:00:00 2001 From: Hanabi <78060373+KurobaKaitou@users.noreply.github.com> Date: Mon, 20 Oct 2025 12:32:09 +0800 Subject: [PATCH 2/9] =?UTF-8?q?docs:=20=E8=A1=A5=E5=85=85=E6=BA=90?= =?UTF-8?q?=E7=A0=81=E9=83=A8=E7=BD=B2=E6=97=B6=E5=AE=89=E8=A3=85=20ffmpeg?= =?UTF-8?q?=20=E7=8E=AF=E5=A2=83=E5=8F=AF=E8=83=BD=E4=BC=9A=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=E7=BC=BA=E5=A4=B1=E5=8A=A8=E6=80=81=E5=BA=93=E7=9A=84?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=96=B9=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 补充说明 --- docs/Deployment_all.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/Deployment_all.md b/docs/Deployment_all.md index bad1c4df..91ba1f01 100644 --- a/docs/Deployment_all.md +++ b/docs/Deployment_all.md @@ -331,7 +331,7 @@ npm run serve ## 5.安装Python环境 -本项目使用`conda`管理依赖环境。如果不方便安装`conda`,需要根据实际的操作系统安装好`libopus`和`ffmpeg`。 +本项目使用`conda`管理依赖环境。如果不方便安装`conda`,需要根据实际的操作系统安装好`libopus`和``。 如果确定使用`conda`,则安装好后,开始执行以下命令。 重要提示!windows 用户,可以通过安装`Anaconda`来管理环境。安装好`Anaconda`后,在`开始`那里搜索`anaconda`相关的关键词, @@ -355,6 +355,9 @@ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/ conda install libopus -y conda install ffmpeg -y + +# 在 Linux 环境下进行部署时,如出现类似缺失 libiconv.so.2 动态库的报错 请通过以下命令进行安装 +conda install libiconv ``` 请注意,以上命令,不是一股脑执行就成功的,你需要一步步执行,每一步执行完后,都检查一下输出的日志,查看是否成功。 From 8b261d473a679ffc7a70f97a2395655558d1ffda Mon Sep 17 00:00:00 2001 From: Hanabi <78060373+KurobaKaitou@users.noreply.github.com> Date: Mon, 20 Oct 2025 12:53:40 +0800 Subject: [PATCH 3/9] =?UTF-8?q?fix:=20=E8=A1=A5=E5=85=85README=E6=96=87?= =?UTF-8?q?=E6=A1=A3=20334=E8=A1=8C=E7=9A=84=20ffmpeg=20=E5=8D=95=E8=AF=8D?= =?UTF-8?q?=E7=BC=BA=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 补充README文档 334行的 ffmpeg 单词缺失 --- docs/Deployment_all.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Deployment_all.md b/docs/Deployment_all.md index 91ba1f01..c63941dc 100644 --- a/docs/Deployment_all.md +++ b/docs/Deployment_all.md @@ -331,7 +331,7 @@ npm run serve ## 5.安装Python环境 -本项目使用`conda`管理依赖环境。如果不方便安装`conda`,需要根据实际的操作系统安装好`libopus`和``。 +本项目使用`conda`管理依赖环境。如果不方便安装`conda`,需要根据实际的操作系统安装好`libopus`和`ffmpeg`。 如果确定使用`conda`,则安装好后,开始执行以下命令。 重要提示!windows 用户,可以通过安装`Anaconda`来管理环境。安装好`Anaconda`后,在`开始`那里搜索`anaconda`相关的关键词, From d374b77baae0c0b3f837f07389566d5d68baeb2a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Oct 2025 11:51:47 +0000 Subject: [PATCH 4/9] build(deps): bump dashscope in /main/xiaozhi-server Bumps [dashscope](https://dashscope.aliyun.com/) from 1.23.1 to 1.24.6. --- updated-dependencies: - dependency-name: dashscope dependency-version: 1.24.6 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- main/xiaozhi-server/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100755 => 100644 main/xiaozhi-server/requirements.txt diff --git a/main/xiaozhi-server/requirements.txt b/main/xiaozhi-server/requirements.txt old mode 100755 new mode 100644 index 75964ec9..ceb06fc4 --- a/main/xiaozhi-server/requirements.txt +++ b/main/xiaozhi-server/requirements.txt @@ -25,7 +25,7 @@ sherpa_onnx==1.12.11 mcp==1.13.1 cnlunar==0.2.0 PySocks==1.7.1 -dashscope==1.23.1 +dashscope==1.24.6 baidu-aip==4.16.13 chardet==5.2.0 aioconsole==0.8.1 From c53e3ed965e2876dd573b681639afbedd22d9c9b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Oct 2025 11:51:52 +0000 Subject: [PATCH 5/9] build(deps): bump ormsgpack from 1.7.0 to 1.11.0 in /main/xiaozhi-server Bumps [ormsgpack](https://github.com/aviramha/ormsgpack) from 1.7.0 to 1.11.0. - [Release notes](https://github.com/aviramha/ormsgpack/releases) - [Changelog](https://github.com/aviramha/ormsgpack/blob/master/CHANGELOG.md) - [Commits](https://github.com/aviramha/ormsgpack/compare/1.7.0...1.11.0) --- updated-dependencies: - dependency-name: ormsgpack dependency-version: 1.11.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- main/xiaozhi-server/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100755 => 100644 main/xiaozhi-server/requirements.txt diff --git a/main/xiaozhi-server/requirements.txt b/main/xiaozhi-server/requirements.txt old mode 100755 new mode 100644 index 75964ec9..58353a2e --- a/main/xiaozhi-server/requirements.txt +++ b/main/xiaozhi-server/requirements.txt @@ -13,7 +13,7 @@ edge_tts==7.0.0 httpx==0.27.2 aiohttp==3.12.15 aiohttp_cors==0.7.0 -ormsgpack==1.7.0 +ormsgpack==1.11.0 ruamel.yaml==0.18.15 loguru==0.7.3 requests==2.32.5 From c85ffcc181f765f3fdd191921d91b6d6b6cc22de Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Oct 2025 11:56:58 +0000 Subject: [PATCH 6/9] build(deps): bump openai from 1.107.0 to 2.5.0 in /main/xiaozhi-server Bumps [openai](https://github.com/openai/openai-python) from 1.107.0 to 2.5.0. - [Release notes](https://github.com/openai/openai-python/releases) - [Changelog](https://github.com/openai/openai-python/blob/main/CHANGELOG.md) - [Commits](https://github.com/openai/openai-python/compare/v1.107.0...v2.5.0) --- updated-dependencies: - dependency-name: openai dependency-version: 2.5.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- main/xiaozhi-server/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100755 => 100644 main/xiaozhi-server/requirements.txt diff --git a/main/xiaozhi-server/requirements.txt b/main/xiaozhi-server/requirements.txt old mode 100755 new mode 100644 index 75964ec9..585d7471 --- a/main/xiaozhi-server/requirements.txt +++ b/main/xiaozhi-server/requirements.txt @@ -7,7 +7,7 @@ numpy==1.26.4 pydub==0.25.1 funasr==1.2.3 torchaudio==2.2.2 -openai==1.107.0 +openai==2.5.0 google-generativeai==0.8.5 edge_tts==7.0.0 httpx==0.27.2 From c992ed48daec310c4cd5f6d67a5ee2e10394b20a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Oct 2025 13:19:35 +0000 Subject: [PATCH 7/9] build(deps): bump torchaudio from 2.2.2 to 2.9.0 in /main/xiaozhi-server Bumps [torchaudio](https://github.com/pytorch/audio) from 2.2.2 to 2.9.0. - [Release notes](https://github.com/pytorch/audio/releases) - [Commits](https://github.com/pytorch/audio/compare/v2.2.2...v2.9.0) --- updated-dependencies: - dependency-name: torchaudio dependency-version: 2.9.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- main/xiaozhi-server/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100755 => 100644 main/xiaozhi-server/requirements.txt diff --git a/main/xiaozhi-server/requirements.txt b/main/xiaozhi-server/requirements.txt old mode 100755 new mode 100644 index 75964ec9..c9f164f6 --- a/main/xiaozhi-server/requirements.txt +++ b/main/xiaozhi-server/requirements.txt @@ -6,7 +6,7 @@ opuslib_next==1.1.2 numpy==1.26.4 pydub==0.25.1 funasr==1.2.3 -torchaudio==2.2.2 +torchaudio==2.9.0 openai==1.107.0 google-generativeai==0.8.5 edge_tts==7.0.0 From ad6607b7f5b927644d2f2bb337ec322534a619bf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Oct 2025 13:19:42 +0000 Subject: [PATCH 8/9] build(deps): bump mem0ai from 0.1.62 to 1.0.0 in /main/xiaozhi-server Bumps [mem0ai](https://github.com/mem0ai/mem0) from 0.1.62 to 1.0.0. - [Release notes](https://github.com/mem0ai/mem0/releases) - [Changelog](https://github.com/mem0ai/mem0/blob/main/docs/changelog.mdx) - [Commits](https://github.com/mem0ai/mem0/compare/0.1.62...v1.0.0) --- updated-dependencies: - dependency-name: mem0ai dependency-version: 1.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- main/xiaozhi-server/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100755 => 100644 main/xiaozhi-server/requirements.txt diff --git a/main/xiaozhi-server/requirements.txt b/main/xiaozhi-server/requirements.txt old mode 100755 new mode 100644 index 75964ec9..d7175def --- a/main/xiaozhi-server/requirements.txt +++ b/main/xiaozhi-server/requirements.txt @@ -18,7 +18,7 @@ ruamel.yaml==0.18.15 loguru==0.7.3 requests==2.32.5 cozepy==0.19.0 -mem0ai==0.1.62 +mem0ai==1.0.0 bs4==0.0.2 modelscope==1.23.2 sherpa_onnx==1.12.11 From c9b7d77094c3fa8d0dcd5e9a6934770190619a03 Mon Sep 17 00:00:00 2001 From: hrz <1710360675@qq.com> Date: Wed, 22 Oct 2025 09:16:33 +0800 Subject: [PATCH 9/9] =?UTF-8?q?updte:python3.10=E6=9C=80=E9=AB=98=E5=8F=AA?= =?UTF-8?q?=E6=94=AF=E6=8C=81torch=3D=3D2.2.2=E3=80=81torchaudio=3D=3D2.2.?= =?UTF-8?q?2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/xiaozhi-server/requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/xiaozhi-server/requirements.txt b/main/xiaozhi-server/requirements.txt index 073edb3a..bc9d6956 100644 --- a/main/xiaozhi-server/requirements.txt +++ b/main/xiaozhi-server/requirements.txt @@ -6,7 +6,7 @@ opuslib_next==1.1.2 numpy==1.26.4 pydub==0.25.1 funasr==1.2.3 -torchaudio==2.9.0 +torchaudio==2.2.2 openai==2.5.0 google-generativeai==0.8.5 edge_tts==7.0.0 @@ -35,4 +35,4 @@ PyJWT==2.8.0 psutil==7.0.0 portalocker==3.2.0 Jinja2==3.1.6 -vosk==0.3.45 +vosk==0.3.44