快速结论:这个报错通常出现在 LiteLLM Docker 镜像缺少音频处理所需的 libsndfile 系统库时,典型场景是在 UI 中为 gpt-4o-transcribe-diarize 这类音频转录模型点击 “Test Connect” 或实际调用 /audio/transcriptions。优先检查镜像版本是否已升级到 v1.95.0 或更新版本,并确认容器内 libsndfile.so 是否存在。
适用环境:LiteLLM Proxy(Docker 部署);涉及镜像 ghcr.io/berriai/litellm-database:main-stable(Issue 打开时对应 tag main-v1.80.8-stable.1);Python 3.13;问题在 gpt-4o-transcribe-diarize 音频转录场景触发。
最快修复方案:将 litellm-database 镜像升级到 v1.95.0 或更新版本。Issue 关闭时已确认在 ghcr.io/berriai/litellm-database:main-stable(v1.95.0)中 libsndfile 已安装,libsndfile.so.1 可用,且 import soundfile 成功。
注意事项:修复只针对 v1.95.0 及之后的镜像验证过;如果你使用的仍是 v1.80.x 等旧版本,需要先拉取新镜像并重新创建容器。若升级后仍出现同样报错,请确认实际运行的镜像 tag,并携带完整错误重新反馈。维护者早期曾建议改用 litellm-alpine 镜像(其中包含 libsndfile),但这会改变镜像部署形态,且你需要自行评估对数据库持久化配置方式的影响。
问题场景
用户在 Docker 中运行 LiteLLM Proxy,通过 ghcr.io/berriai/litellm-database:main-stable 镜像搭建服务,并在 UI 中配置 OpenAI 的 gpt-4o-transcribe-diarize 音频转录模型。配置完成后点击 Test Connect 按钮,随即报错无法加载 libsndfile.so,更进一步导致 ModuleNotFoundError: No module named '_soundfile_data'。后续评论也确认在 main-v1.80.15.rc.2 与 main-v1.80.15-nightly 镜像上同样存在此问题。
报错原文
litellm.APIConnectionError: APIConnectionError: OpenAIException - cannot load library 'libsndfile.so': libsndfile.so: cannot open shared object file: No such file or directory
stack trace: Traceback (most recent call last):
File "/usr/lib/python3.13/site-packages/soundfile.py", line 161, in <module>
import _soundfile_data # ImportError if this doesn't exist
^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named '_soundfile_data'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.13/site-packages/soundfile.py", line 170, in <module>
raise OSError('sndfile library not found using ctypes.util.find_library')
OSError: sndfile library not found using ctypes.util.find_library
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.13/site-packages/litellm/main.py", line 5659, in atranscription
calculated_duration = calculate_request_duration(file)
File "/usr/lib/python3.13/site-packages/litellm/litellm_core_utils/audio_utils/utils.py", line 152, in calculate_request_duration
import soundfile as sf
原因分析
根本原因是 litellm-database 这个镜像在构建时没有安装音频处理所需的系统库 libsndfile。Python 的 soundfile 模块依赖该动态库,而 LiteLLM 在每次处理音频转录请求时,会调用 calculate_request_duration 计算音频时长,函数内部 import soundfile,最终因找不到 libsndfile.so 而失败。这里的 _soundfile_data 只是 soundfile 模块内部加载库失败前的表象,真正的缺失项是系统级共享库 libsndfile.so。
环境排查
- 确认当前运行的 LiteLLM 镜像完整 tag,例如
ghcr.io/berriai/litellm-database:main-stable对应的 LiteLLM 版本。 - 检查容器内是否存在
libsndfile.so或libsndfile.so.1:docker exec <container> ldconfig -p | grep sndfile
参考来源
AI 工具推荐
想把多个 AI 模型放在一个入口?
GamsGo AI 集成 ChatGPT、DeepSeek、Gemini、Claude、Midjourney、Veo 等常用模型,适合写作、绘图、视频和日常 AI 工作流。
推广链接:通过此链接购买,我可能获得佣金,不影响你的价格。
这个方案解决了吗?
可以继续搜索完整报错,或查看同一工具的其他排查指南。
![[bug]: Having a connector between a generator and a batch node won't let Invoke start a generation](https://www.chat-gpts.plus/wp-content/uploads/2026/08/9150-595a19d6-768x403.jpg)
![[bug]: invoke desktop application fails to updated due to (valid) global uv configuration](https://www.chat-gpts.plus/wp-content/uploads/2026/08/9498-a09c004e-768x403.jpg)
![[Question]: error when attaching file in chat ----AttributeError("'Request' object has no attribute 'file'")](https://www.chat-gpts.plus/wp-content/uploads/2026/08/11805-40332ec3-768x403.jpg)