#5803 zt@Mac pyvideotrans % uv syncResolved 417 packages in 1.62s × Failed to build pynini==2.1.6 ├─▶ The build backend retu

2a14:7dc0* Posted at: 1 day ago

zt@Mac pyvideotrans % uv sync
Resolved 417 packages in 1.62s
× Failed to build pynini==2.1.6
├─▶ The build backend returned an error
╰─▶ Call to setuptools.build_meta:__legacy__.build_wheel failed (exit

  status: 1)

  [stdout]
  running bdist_wheel
  running build
  running build_py
  copying pywrapfst/__init__.py ->
  build/lib.macosx-11.0-arm64-cpython-310/pywrapfst
  copying pynini/__init__.py ->
  build/lib.macosx-11.0-arm64-cpython-310/pynini
  copying pynini/examples/chatspeak.py ->
  build/lib.macosx-11.0-arm64-cpython-310/pynini/examples
  copying pynini/examples/chatspeak_model.py ->
  build/lib.macosx-11.0-arm64-cpython-310/pynini/examples
  copying pynini/examples/weather.py ->
  build/lib.macosx-11.0-arm64-cpython-310/pynini/examples
  copying pynini/examples/__init__.py ->
  build/lib.macosx-11.0-arm64-cpython-310/pynini/examples
  copying pynini/examples/numbers.py ->

......
thon-310/pynini/lib

  copying pynini/export/BUILD.bazel ->
  build/lib.macosx-11.0-arm64-cpython-310/pynini/export
  copying pynini/export/grm_py_build_defs.bzl ->
  build/lib.macosx-11.0-arm64-cpython-310/pynini/export
  copying pynini/export/py.typed ->
  build/lib.macosx-11.0-arm64-cpython-310/pynini/export
  running build_ext
  building '_pynini' extension
  c++ -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG
  -g -fwrapv -O3 -Wall -O3 -arch arm64 -mmacosx-version-min=11.0
  -Wno-nullability-completeness -Wno-expansion-to-defined -Wno-undef-prefix
  -fPIC -Iextensions -I/Users/zt/.cache/uv/builds-v0/.tmp7isRZG/include
  -I/Users/zt/.local/share/uv/python/cpython-3.10.19-macos-aarch64-none/include/python3.10
  -c extensions/_pynini.cpp -o
  build/temp.macosx-11.0-arm64-cpython-310/extensions/_pynini.o -std=c++17
  -Wno-register -Wno-deprecated-declarations -Wno-unused-function
  -Wno-unused-local-typedefs -funsigned-char -stdlib=libc++
  -mmacosx-version-min=10.12

  [stderr]
  /Users/zt/.cache/uv/builds-v0/.tmp7isRZG/lib/python3.10/site-packages/setuptools/config/_apply_pyprojecttoml.py:82:
  SetuptoolsDeprecationWarning: `project.license` as a TOML table is
  deprecated
  !!

  
  ********************************************************************************
          Please use a simple string containing a SPDX expression for
  `project.license`. You can also use `project.license-files`. (Both
  options available on setuptools>=77.0.0).

          By 2027-Feb-18, you need to update your project and remove
  deprecated calls
          or your builds will no longer be supported.

          See
  https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license
  for details.
  
  ********************************************************************************

  !!
    corresp(dist, value, root_dir)
  /Users/zt/.cache/uv/builds-v0/.tmp7isRZG/lib/python3.10/site-packages/setuptools/config/_apply_pyprojecttoml.py:61:
  SetuptoolsDeprecationWarning: License classifiers are deprecated.
  !!

  
  ********************************************************************************
          Please consider removing the following classifiers in favor of a
  SPDX license expression:

          License :: OSI Approved :: Apache Software License

          See
  https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license
  for details.
  
  ********************************************************************************

  !!
    dist._finalize_license_expression()
  /Users/zt/.cache/uv/builds-v0/.tmp7isRZG/lib/python3.10/site-packages/setuptools/dist.py:765:
  SetuptoolsDeprecationWarning: License classifiers are deprecated.
  !!

  
  ********************************************************************************
          Please consider removing the following classifiers in favor of a
  SPDX license expression:

          License :: OSI Approved :: Apache Software License

          See
  https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license
  for details.
  
  ********************************************************************************

  !!
    self._finalize_license_expression()
  extensions/_pynini.cpp:1224:10: fatal error: 'fst/util.h' file not found
   1224 | #include 
        |          ^~~~~~~~~~~~
  1 error generated.
  error: command '/usr/bin/c++' failed with exit code 1

hint: pynini (v2.1.6) was included because pyvideotrans (v4.5) depends on pynini
hint: This error likely indicates that you need to install a library that provides "fst/util.h" for [email protected]%

9 Replies

pynini 编译失败是因为缺少 OpenFst 库头文件。这是安装 mosstts 可选依赖时的必要系统库。

解决方案:

  1. 安装 OpenFst(推荐,如需使用 MOSS-TTS):

    brew install openfst

    安装后重新运行 uv sync 即可。

  2. 跳过 MOSS-TTS 可选依赖(如果不需要):
    改为仅安装基础依赖:

    uv sync

    不要加 --extra mosstts--all-extras

  3. 如果仍失败,可手动指定 OpenFst 路径:

    export CPLUS_INCLUDE_PATH=$(brew --prefix openfst)/include:$CPLUS_INCLUDE_PATH
    uv sync --extra mosstts
  4. 确认 Python 版本为 3.10(你的 cpython-3.10.19 符合要求)。

都不得

根据报错信息,pynini 编译失败是由于缺少 OpenFst 库的头文件 fst/util.h。你已经尝试了安装 OpenFst 和跳过 mosstts 可选依赖,但问题依然存在。

可能的原因和解决步骤:

  1. 确认你运行的是基础 uv sync(不包含任何 --extra 参数)

    • 基础命令:uv sync
    • 如果之前运行过带 --extra mosstts--all-extras 的命令,缓存中可能仍持有 pynini 的依赖。请先清理缓存:

      uv cache clean

      然后重新运行 uv sync

  2. 检查 OpenFst 是否已正确安装,并设置环境变量

    • 确认 OpenFst 已安装:brew list openfst
    • 获取 OpenFst 的路径:brew --prefix openfst (通常为 /opt/homebrew/opt/openfst
    • 再次尝试安装(即使不打算使用 mosstts,也可为其他依赖做准备):

      export CPLUS_INCLUDE_PATH=$(brew --prefix openfst)/include:$CPLUS_INCLUDE_PATH
      export LIBRARY_PATH=$(brew --prefix openfst)/lib:$LIBRARY_PATH
      uv sync

      如果仍报错,请检查 /opt/homebrew/opt/openfst/include 下是否存在 fst 目录。

  3. 如果你确实不需要 MOSS-TTS 功能,完全跳过该可选依赖

    • 确认你的 uv sync 命令没有隐式包含 mosstts。检查项目根目录下的 pyproject.toml 文件,确保 [project.optional-dependencies] 中没有多余的 mosstts 被错误激活。
  4. 提供更详细的信息以便进一步排查
    如果以上步骤均无效,请提供以下信息:

    • 你运行的确切命令(复制粘贴到回复中)
    • 执行 brew config 的输出(1~2行关键信息即可)
    • 完整的 uv sync 日志(从执行到报错结束)

请查阅相关文档:

  Built future==0.18.3
  Built encodec==0.1.1

× Failed to build pynini==2.1.6
├─▶ The build backend returned an error
╰─▶ Call to setuptools.build_meta:__legacy__.build_wheel failed (exit

  status: 1)

  [stdout]
  running bdist_wheel
  running build
  running build_py
  creating build/lib.macosx-11.0-arm64-cpython-310/pywrapfst
  copying pywrapfst/__init__.py ->
  build/lib.macosx-11.0-arm64-cpython-310/pywrapfst
  creating build/lib.macosx-11.0-arm64-cpython-310/pynini
  copying pynini/__init__.py ->
  build/lib.macosx-11.0-arm64-cpython-310/pynini
  creating build/lib.macosx-11.0-arm64-cpython-310/pynini/examples
  copying pynini/examples/chatspeak.py ->
  build/lib.macosx-11.0-arm64-cpython-310/pynini/examples
  copying pynini/examples/chatspeak_model.py ->
  build/lib.macosx-11.0-arm64-cpython-310/pynini/examples
  copying pynini/examples/weather.py ->
  

......
-lfstfarscript -lfstfar -lfstscript -lfst -lm -ldl -o

  build/lib.macosx-11.0-arm64-cpython-310/_pywrapfst.cpython-310-darwin.so

  [stderr]
  /Users/zt/.cache/uv/builds-v0/.tmpvuMcs2/lib/python3.10/site-packages/setuptools/config/_apply_pyprojecttoml.py:82:
  SetuptoolsDeprecationWarning: `project.license` as a TOML table is
  deprecated
  !!

  
  ********************************************************************************
          Please use a simple string containing a SPDX expression for
  `project.license`. You can also use `project.license-files`. (Both
  options available on setuptools>=77.0.0).

          By 2027-Feb-18, you need to update your project and remove
  deprecated calls
          or your builds will no longer be supported.

          See
  https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license
  for details.
  
  ********************************************************************************

  !!
    corresp(dist, value, root_dir)
  /Users/zt/.cache/uv/builds-v0/.tmpvuMcs2/lib/python3.10/site-packages/setuptools/config/_apply_pyprojecttoml.py:61:
  SetuptoolsDeprecationWarning: License classifiers are deprecated.
  !!

  
  ********************************************************************************
          Please consider removing the following classifiers in favor of a
  SPDX license expression:

          License :: OSI Approved :: Apache Software License

          See
  https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license
  for details.
  
  ********************************************************************************

  !!
    dist._finalize_license_expression()
  /Users/zt/.cache/uv/builds-v0/.tmpvuMcs2/lib/python3.10/site-packages/setuptools/dist.py:765:
  SetuptoolsDeprecationWarning: License classifiers are deprecated.
  !!

  
  ********************************************************************************
          Please consider removing the following classifiers in favor of a
  SPDX license expression:

          License :: OSI Approved :: Apache Software License

          See
  https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license
  for details.
  
  ********************************************************************************

  !!
    self._finalize_license_expression()
  ld: library 'fstfarscript' not found
  clang++: error: linker command failed with exit code 1 (use -v to see
  invocation)
  error: command '/usr/bin/c++' failed with exit code 1

hint: pynini (v2.1.6) was included because pyvideotrans (v4.5) depends on pynini
hint: Build failures usually indicate a problem with the package or the build environment%

pynini 编译时找到了 OpenFst 头文件,但链接器找不到 libfstfarscript 等库文件。这是因为 OpenFst 的库路径未传递给链接器。

解决方法

  1. 确认 OpenFst 已正确安装(包含动态库):

    brew list openfst

    并检查 /opt/homebrew/opt/openfst/lib 目录下是否存在 libfstfarscript.dylib 等文件。若不存在,重新安装:

    brew reinstall openfst
  2. 设置库搜索路径,让编译器能找到 OpenFst 的 .dylib 文件:

    export CPLUS_INCLUDE_PATH=$(brew --prefix openfst)/include:$CPLUS_INCLUDE_PATH
    export LIBRARY_PATH=$(brew --prefix openfst)/lib:$LIBRARY_PATH
    export LDFLAGS="-L$(brew --prefix openfst)/lib"
    export CPPFLAGS="-I$(brew --prefix openfst)/include"
  3. 清理 uv 缓存并重新安装:

    uv cache clean
    uv sync --extra mosstts   # 如果你确实需要使用 MOSS-TTS
    # 或简单运行:
    uv sync   # 如果不带 extra,pynini 通常不会被安装
  4. 如果你不需要 MOSS-TTS 功能,最简便的方法是不安装该可选依赖。直接运行:

    uv sync

    因为 pynini 仅仅是 mosstts 可选依赖的一部分,基础依赖不会安装它。


如果以上步骤仍失败,请确认你运行 uv sync没有无意中使用了 --all-extras--extra mosstts。若基础 uv sync 也报错,请检查 pyproject.toml[project.optional-dependencies] 下的 mosstts 是否被错误地移入了主依赖。

请查阅相关文档:

打开 pyproject.toml
大约260行左右删掉这两行

    "WeTextProcessing",

不可使用mosstts

"pynini",
"WeTextProcessing",

可以了,删除掉那两个

根据开发者的权威回复,pynini 编译失败的原因是 pyproject.toml 中错误包含了 mosstts 的可选依赖项。解决步骤如下:

  1. 打开项目根目录下的 pyproject.toml 文件。
  2. 找到 大约260行 附近的 [project.optional-dependencies] 下的 mosstts 部分。
  3. 删除以下两行:

    "pynini",
    "WeTextProcessing",
  4. 保存文件后,重新运行:

    uv cache clean
    uv sync

注意:删除后你将无法使用 mosstts 配音渠道(MOSS-TTS)。如需该功能,需自行解决 OpenFst 链接问题(参见上文环境变量设置)。

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.

Dondate via ko-fi.com

Dondate via PayPal

Related resource