#1000 ImportError: cannot import name 'Sentinel' from 'typing_extensions' (/home/Timoshenko/miniconda3/lib/python3.10/site-pac

2409:8a3c* Posted at: 6 days ago 👁72

Traceback (most recent call last):
File "/home/Timoshenko/apps/pyVideoTrans/pyvideotrans/videotrans/task/job.py", line 105, in run

trk.recogn()

File "/home/Timoshenko/apps/pyVideoTrans/pyvideotrans/videotrans/task/trans_create.py", line 331, in recogn

raw_subtitles = run_recogn(

File "/home/Timoshenko/apps/pyVideoTrans/pyvideotrans/videotrans/recognition/__init__.py", line 222, in run

return FasterAll(**kwargs).run()

File "/home/Timoshenko/apps/pyVideoTrans/pyvideotrans/videotrans/recognition/_base.py", line 78, in run

return self._exec()

File "/home/Timoshenko/apps/pyVideoTrans/pyvideotrans/videotrans/recognition/_overall.py", line 196, in _exec

raise RuntimeError(tr('No speech was detected, please make sure there is human speech in the selected audio/video and that the language is the same as the selected one.'))

RuntimeError: 没有识别到任何说话声,请确认所选音视频中是否包含人类说话声,以及说话语言是否同所选一致

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/Timoshenko/apps/pyVideoTrans/pyvideotrans/videotrans/task/job.py", line 116, in run

from videotrans.configure._except import get_msg_from_except

File "/home/Timoshenko/apps/pyVideoTrans/pyvideotrans/videotrans/configure/_except.py", line 3, in

from elevenlabs.core import ApiError as ApiError_11

File "/home/Timoshenko/miniconda3/lib/python3.10/site-packages/elevenlabs/__init__.py", line 5, in

from .types import (

File "/home/Timoshenko/miniconda3/lib/python3.10/site-packages/elevenlabs/types/__init__.py", line 5, in

from .add_chapter_response_model import AddChapterResponseModel

File "/home/Timoshenko/miniconda3/lib/python3.10/site-packages/elevenlabs/types/add_chapter_response_model.py", line 5, in

import pydantic

File "/home/Timoshenko/miniconda3/lib/python3.10/site-packages/pydantic/__init__.py", line 5, in

from ._migration import getattr_migration

File "/home/Timoshenko/miniconda3/lib/python3.10/site-packages/pydantic/_migration.py", line 4, in

from pydantic.warnings import PydanticDeprecatedSince20

File "/home/Timoshenko/miniconda3/lib/python3.10/site-packages/pydantic/warnings.py", line 5, in

from .version import version_short

File "/home/Timoshenko/miniconda3/lib/python3.10/site-packages/pydantic/version.py", line 7, in

from pydantic_core import __version__ as __pydantic_core_version__

File "/home/Timoshenko/miniconda3/lib/python3.10/site-packages/pydantic_core/__init__.py", line 6, in

from typing_extensions import Sentinel

ImportError: cannot import name 'Sentinel' from 'typing_extensions' (/home/Timoshenko/miniconda3/lib/python3.10/site-packages/typing_extensions.py)

=====
Linux-6.12.41-amd64-desktop-rolling-x86_64-with-glibc2.38
version:v3.81
frozen:False
language:zh

1 Replies

本条内容由 gpt-5-mini 回复

问题有两部分:一是识别器报“没有识别到任何说话声”;二是在处理该异常时环境中 Python 包不兼容(typing_extensions 缺少 Sentinel)导致程序崩溃。核心解决思路:先确认音频/语言是否真的没有人声,其次修复 Python 包依赖以避免二次异常阻断诊断。

可能原因与解决步骤(按顺序执行):

  1. 先确认“没有识别到任何说话声”的本质原因

    1. 播放原视频/音频,确认确实包含清晰的人声(非纯背景音乐、非画面硬字幕)。
    2. 在软件中确认所选识别语言与视频实际语言一致(否则识别会判为无语音)。
    3. 如果视频有多音轨,确认软件选择了正确的音轨(或用外部工具提取并试听音轨)。
    4. 用“音视频转字幕”单独跑一次,观察是否仍提示无语音。
    5. 如果声音很小或背景噪声大,尝试先在别的播放器中放大或做降噪/增强后再识别。
  2. 修复 ImportError(cannot import name 'Sentinel' from 'typing_extensions')
    说明:这个错误来自系统 Python 包不兼容,导致在处理识别异常(构建错误信息时)导入 elevenlabs/pydantic 时失败,使得程序无法正常记录/显示异常。解决方法是把 typing_extensions(及必要时 pydantic/pydantic-core)升级到兼容版本,然后重启软件。
    推荐命令(在你的 miniconda 环境下执行):

    • 推荐做法(使用当前 Python 执行 pip,确保安装到运行 pyVideoTrans 的环境):
      /home/Timoshenko/miniconda3/bin/python -m pip install --upgrade typing_extensions
      /home/Timoshenko/miniconda3/bin/python -m pip install --upgrade pydantic pydantic-core
    • 或者使用 conda(如果偏好 conda 管理):
      conda activate base # 或你实际运行 pyVideoTrans 的 conda env
      conda install -c conda-forge typing-extensions pydantic pydantic-core
      执行后重启 pyVideoTrans(确保用同一环境启动),再重现问题,查看是否仍然抛出 ImportError。
  3. 再次运行并收集日志(若问题仍然存在)

    1. 先修好依赖后,重试一次识别流程;若仍提示“没有识别到任何说话声”,请将最近的日志文件发来分析(日志目录:videotrans/logs/ ,文件名格式为 YYYYMMDD.log)。
    2. 若在升级 typing_extensions 后仍有导入错误,请把升级输出与完整 Traceback 一并提供。

如果按照上述步骤无法解决,请提供:

  • videotrans/logs/ 下最近的日志(出错时间对应的日志文件)
  • 你如何启动 pyVideoTrans(命令或桌面方式,及使用的 conda/env)
  • 你用的识别渠道与选择的语言(如 faster-whisper 本地 + 英语)
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