#975 ModuleNotFoundError: No module named 'elevenlabs'

2001:19f0* Posted at: 1 day ago 👁10

Traceback (most recent call last):

File "/Users/a1234/Downloads/pyvideotrans/videotrans/util/TestSTT.py", line 18, in run

res = recognition.run(

File "/Users/a1234/Downloads/pyvideotrans/videotrans/recognition/__init__.py", line 203, in run

from ._deepgram import DeepgramRecogn

File "/Users/a1234/Downloads/pyvideotrans/videotrans/recognition/_deepgram.py", line 10, in

from deepgram import (

ImportError: cannot import name 'DeepgramClient' from 'deepgram' (/Users/a1234/Downloads/pyvideotrans/venv/lib/python3.10/site-packages/deepgram/__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/Users/a1234/Downloads/pyvideotrans/videotrans/util/TestSTT.py", line 28, in run

from videotrans.configure._except import get_msg_from_except

File "/Users/a1234/Downloads/pyvideotrans/videotrans/configure/_except.py", line 3, in

from elevenlabs.core import ApiError as ApiError_11

ModuleNotFoundError: No module named 'elevenlabs'

=====

macOS-15.6.1-arm64-arm-64bit

version:v3.81

frozen:False

language:zh

1 Replies

本条内容由 gpt-5-mini 回复
问题初步判断:第一个错误表明当前安装的 deepgram Python 包与代码中期望的导入名不一致(缺少 DeepgramClient);第二个错误是缺少 elevenlabs 包。原因通常是虚拟环境依赖未安装或 deepgram SDK 版本与源码不兼容。

请按以下步骤排查并修复:

1. 激活虚拟环境(在项目目录下):

  • macOS 示例:

source /Users/a1234/Downloads/pyvideotrans/venv/bin/activate

2. 尝试安装/更新项目依赖(优先安装 requirements 文件里的依赖):

  • 如果仓库有 requirements.txt:

pip install -U -r /Users/a1234/Downloads/pyvideotrans/requirements.txt

  • 如果没有或希望先快速补缺少的包:

pip install -U deepgram elevenlabs

3. 检查 deepgram 包的实际导出和版本,确认问题来源:

  • 查看已安装包版本:

pip show deepgram

  • 在 Python 中检查导出符号:

python -c "import deepgram; import inspect; print(getattr(deepgram,'__version__',None)); print([n for n in dir(deepgram) if not n.startswith('_')])"

  • 若输出中没有 DeepgramClient,说明 SDK 接口变化。此时有两个可选方案:

a. 安装与源码兼容的 deepgram 版本(若你知道项目原来兼容的版本,可执行 pip install deepgram==<版本>)。

b. 修改源码中导入/使用处(文件 videotrans/recognition/_deepgram.py),将缺失的类名改为当前 SDK 提供的客户端类(例如检查 deepgram 包中是否有 Deepgram 或其他 client 名称),然后相应调整调用(仅在你能确认变更安全时进行)。

4. elevenlabs 缺失直接安装:

pip install elevenlabs

(如安装后仍报错,请贴出 pip install 的错误信息;有时包名或发行版不同,可检查项目文档或 pyproject/requirements 指定的准确包名)

5. 重新运行报错脚本,观察是否还有新的导入/运行错误:

python /Users/a1234/Downloads/pyvideotrans/videotrans/util/TestSTT.py

6. 如果问题仍未解决,请提供以下信息以便进一步定位:

  • videotrans/logs/ 目录下最新的日志文件(完整内容)。
  • 执行 pip freeze 的输出(在激活的 venv 中运行 pip freeze > deps.txt 并上传 deps.txt)。
  • 上述检查步骤中 python -c 检查 deepgram 输出结果的原始内容。
  • 若你对修改源码(第3.b选项)有尝试,请贴出修改前后相关文件片段(videotrans/recognition/_deepgram.py 的前 40 行)。

根据现有信息,这是最可能的原因和可行的修复步骤;若提供上述日志与 pip freeze,我可进一步给出精确的修复方法。

Post Your Reply
Open source and free maintenance is not easy. If this project is helpful to you, please consider making a small donation to help the project continue to maintain and update.

Donate: https://ko-fi.com/jianchang512

Trending Questions