#4371 Warning: flash-attn is not installed. Will only run the manual PyTorch version. Please install flash-attn for faster inf

51.75* Posted at: 4 hours ago 👁16

Warning: flash-attn is not installed. Will only run the manual PyTorch version. Please install flash-attn for faster inference.


/bin/sh: sox: command not found
SoX could not be found!

If you do not have SoX, proceed here:


If you do (or think that you should) have SoX, double-check your
path variables.

Setting pad_token_id to eos_token_id:2150 for open-end generation.

5 Replies

警告是由于运行模型时缺少依赖组件导致的,不会完全阻止运行,但可能影响速度或功能。

1. flash-attn 未安装

  • 影响:Flash Attention 是用于加速 Transformer 模型训练/推理的库,未安装时将回退到 PyTorch 原生实现,速度会明显变慢
  • 解决

    pip install flash-attn --no-build-isolation

    如果编译失败,请确保已安装 CUDA 和合适的 PyTorch 版本,或尝试使用预编译包(仅限 Linux + NVIDIA GPU)。在 macOS 或 Windows 上可能无法直接安装,但可以忽略此警告。

2. SoX 未安装(SoX could not be found

  • 影响:SoX 是音频处理工具,某些音频预处理操作(如重采样、格式转换)依赖它,缺失可能导致音质异常或无法生成音频。
  • 解决

    • Linuxsudo apt install sox(Debian/Ubuntu) 或 sudo yum install sox(CentOS)。
    • macOSbrew install sox
    • Windows:需下载安装包并配置环境变量,或通过 Conda 安装 conda install -c conda-forge sox

如果这是部署 pyVideoTrans 的 F5-TTS 配音渠道 时遇到的情况,请确保启动 F5-TTS API 服务后保持环境完整。更多细节可查阅相关文档。

请查阅相关文档:

pip install flash-attn --no-build-isolation
zsh: command not found: pip

系统中不存在 pip 命令,说明 Python 环境未正确配置或尚未安装 pip。请先确认已安装 Python 3.10+,并尝试以下方案:

  1. 使用 python3 -m pip install flash-attn --no-build-isolation 代替 pip
  2. 如果项目使用 uv 管理依赖(根据 pyVideoTrans 源码部署文档),应执行:uv pip install flash-attn --no-build-isolation
  3. 如果 pip 仍未找到,请参考 pip 官方安装文档 或使用所发行版的包管理器(如 apt install python3-pip)。

若以上仍无法解决,请提供软件安装目录下 logs/ 文件夹中最新的日志文件(复制底部约30行报错信息)以便进一步分析。

请查阅相关文档:

pip3 install flash-attn --no-build-isolation
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try brew install

xyz, where xyz is the package you are trying to
install.

If you wish to install a Python library that isn't in Homebrew,
use a virtual environment:

python3 -m venv path/to/venv
source path/to/venv/bin/activate
python3 -m pip install xyz

If you wish to install a Python application that isn't in Homebrew,
it may be easiest to use 'pipx install xyz', which will manage a
virtual environment for you. You can install pipx with

brew install pipx

You may restore the old behavior of pip by passing
the '--break-system-packages' flag to pip, or by adding
'break-system-packages = true' to your pip.conf file. The latter
will permanently disable this error.

If you disable this error, we STRONGLY recommend that you additionally
pass the '--user' flag to pip, or set 'user = true' in your pip.conf
file. Failure to do this can result in a broken Homebrew installation.

Read more about this behavior here: 

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
junyouchen@JunyouChendeMacBook-Air pyvideotrans % pip install flash-attn --no-build-isolation
zsh: command not found: pip
junyouchen@JunyouChendeMacBook-Air pyvideotrans % uv pip install flash-attn --no-build-isolation。
error: unexpected argument '--no-build-isolation。' found

tip: a similar argument exists: '--no-build-isolation'

Usage: uv pip install --no-build-isolation

For more information, try '--help'.

flash-attn 警告是因为此库依赖 CUDA,在 macOS 上几乎无法正常安装(无 NVIDIA GPU 时也不会生效),可以安全忽略,不会阻止程序运行。sox: command not found 则是缺少音频工具,必须安装。

解决步骤:

  1. 安装 SoX:brew install sox
  2. 忽略 Flash Attention 警告,或在虚拟环境中尝试安装(大概率失败):

    • 使用项目自带的 uv 环境:uv pip install flash-attn --no-build-isolation(注意去掉多余句号)
    • 如果仍然失败,证明当前环境不支持,可跳过此步骤。

如部署的是 F5-TTS 配音渠道,参考音频、API 地址等其他配置更关键。

请查阅相关文档:

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.

Related resource