#1160 ModuleNotFoundError: No module named 'aiohttp'

150.242* Posted at: 6 days ago 👁29

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/urllib/request.py", line 1319, in do_open

h.request(req.get_method(), req.selector, req.data, headers,
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          encode_chunked=req.has_header('Transfer-encoding'))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/http/client.py", line 1338, in request

self._send_request(method, url, body, headers, encode_chunked)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/http/client.py", line 1384, in _send_request

self.endheaders(body, encode_chunked=encode_chunked)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

......
trans/recognition/__init__.py", line 178, in run

return OpenaiWhisperRecogn(**kwargs).run()
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^

File "/Users/m.i.a369/Documents/trae_projects/pyvideotrans/videotrans/recognition/_base.py", line 78, in run

return self._exec()
       ~~~~~~~~~~^^

File "/Users/m.i.a369/Documents/trae_projects/pyvideotrans/videotrans/recognition/_openai.py", line 46, in _exec

model = whisper.load_model(
    self.model_name,
    device="cuda" if self.is_cuda else "cpu",
    download_root=config.ROOT_DIR + "/models"
)

File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/whisper/__init__.py", line 137, in load_model

checkpoint_file = _download(_MODELS[name], download_root, in_memory)

File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/whisper/__init__.py", line 73, in _download

with urllib.request.urlopen(url) as source, open(download_target, "wb") as output:
     ~~~~~~~~~~~~~~~~~~~~~~^^^^^

File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/urllib/request.py", line 189, in urlopen

return opener.open(url, data, timeout)
       ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^

File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/urllib/request.py", line 489, in open

response = self._open(req, data)

File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/urllib/request.py", line 506, in _open

result = self._call_chain(self.handle_open, protocol, protocol +
                          '_open', req)

File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/urllib/request.py", line 466, in _call_chain

result = func(*args)

File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/urllib/request.py", line 1367, in https_open

return self.do_open(http.client.HTTPSConnection, req,
       ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    context=self._context)
                    ^^^^^^^^^^^^^^^^^^^^^^

File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/urllib/request.py", line 1322, in do_open

raise URLError(err)

urllib.error.URLError:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/m.i.a369/Documents/trae_projects/pyvideotrans/videotrans/task/job.py", line 116, in run

from videotrans.configure._except import get_msg_from_except

File "/Users/m.i.a369/Documents/trae_projects/pyvideotrans/videotrans/configure/_except.py", line 3, in

import aiohttp

ModuleNotFoundError: No module named 'aiohttp'


=
system:macOS-26.0.1-arm64-arm-64bit-Mach-O
version:v3.82
frozen:False
language:zh
root_dir:/Users/m.i.a369/Documents/trae_projects/pyvideotrans
Python: 3.13.7 (v3.13.7:bcee1c32211, Aug 14 2025, 19:10:51) [Clang 16.0.0 (clang-1600.0.26.6)]

1 Replies

这个错误是由于 SSL 证书验证失败导致无法下载 OpenAI Whisper 模型文件,同时系统缺少必要的依赖模块。

问题分析:

  1. 主要错误:ssl.SSLCertVerificationError - 在下载 Whisper 模型时 SSL 证书验证失败
  2. 次要错误:ModuleNotFoundError: No module named 'aiohttp' - 缺少 aiohttp 依赖

解决方案:

方法一:设置网络代理(推荐)

  1. 在软件菜单栏选择 翻译设置
  2. 在网络代理设置中配置可用的代理服务器
  3. 重新尝试运行语音识别

方法二:手动下载模型

  1. 手动从 Hugging Face 或其他镜像源下载 Whisper 模型文件
  2. 将模型文件放置在 软件根目录/models/ 文件夹中
  3. 模型文件命名规则参考 Whisper 官方文档

方法三:修复依赖和证书问题

  1. 安装缺失的依赖:pip install aiohttp
  2. 更新系统证书:/Applications/Python\ 3.13/Install\ Certificates.command(如果使用 Python 官方安装包)
  3. 或者尝试:pip install --upgrade certifi

临时解决方案:

  • 切换到其他语音识别渠道,如 faster-whisper(本地)阿里FunASR(本地)
  • 这些渠道可能使用不同的下载机制,可以绕过当前的证书问题

建议先尝试设置网络代理,如果问题依旧,请提供更详细的网络环境信息。

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