废话少说
(为什么pyopenjtalk死活装不上呐~🤬
安装失败的提示
PS D:\Software\vits> python -m pip install pyopenjtalk -i https://pypi.tuna.tsinghua.edu.cn/simple
WARNING: Ignoring invalid distribution -rotobuf (d:\software\python\lib\site-packages)
WARNING: Ignoring invalid distribution -rotobuf (d:\software\python\lib\site-packages)
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pyopenjtalk
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/b4/80/a2505a37937fcd108b7c1ab66f7d1d48560525b1da71993860d11095a286/pyopenjtalk-0.3.0.tar.gz (1.5 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [23 lines of output]
Traceback (most recent call last):
File "D:\Software\python\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
main()
File "D:\Software\python\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "D:\Software\python\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
File "C:\Users\administrator\AppData\Local\Temp\pip-build-env-isarggvi\overlay\Lib\site-packages\setuptools\build_meta.py", line 162, in get_requires_for_build_wheel
return self._get_build_requires(
File "C:\Users\administrator\AppData\Local\Temp\pip-build-env-isarggvi\overlay\Lib\site-packages\setuptools\build_meta.py", line 143, in _get_build_requires
self.run_setup()
File "C:\Users\administrator\AppData\Local\Temp\pip-build-env-isarggvi\overlay\Lib\site-packages\setuptools\build_meta.py", line 267, in run_setup
super(_BuildMetaLegacyBackend,
File "C:\Users\administrator\AppData\Local\Temp\pip-build-env-isarggvi\overlay\Lib\site-packages\setuptools\build_meta.py", line 158, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 153, in <module>
File "D:\Software\python\lib\subprocess.py", line 501, in run
with Popen(*popenargs, **kwargs) as process:
File "D:\Software\python\lib\subprocess.py", line 969, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "D:\Software\python\lib\subprocess.py", line 1438, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] 系统找不到指定的文件。
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
看不懂呐看不懂
实际原因是pip在安装pyopenjtalk的时候,下载了pyopenjtalk的源代码然后尝试在本地编译,结果本地不存在编译环境,导致报错。
上述“系统找不到指定的文件”,在执行命令
cmake .. -DHTS_ENGINE_INCLUDE_DIR=. -DHTS_ENGINE_LIB=dummy
但因为环境变量中不存在cmake相关路径,因此报错。
不折腾
只是为了使用vits,直接安装二进制
前往openjtalk · PyPI下载Built Distributions中的.whl文件
需要注意下载正确的版本,例如:CP310指的是python3.10版本,win_amd64指的是64位windows系统
然后通过cmd/powershell运行命令(需要注意填写正确的.whl文件路径)
python -m pip install .\openjtalk-0.3.0.dev2-cp310-cp310-win_amd64.whl
或
pip install .\openjtalk-0.3.0.dev2-cp310-cp310-win_amd64.whl
安装成功
PS D:\Software\vits> python -m pip install .\openjtalk-0.3.0.dev2-cp310-cp310-win_amd64.whl
Processing d:\software\vits-uma-genshin-honkai\openjtalk-0.3.0.dev2-cp310-cp310-win_amd64.whl
Requirement already satisfied: cython>=0.21.0 in d:\software\python\lib\site-packages (from openjtalk==0.3.0.dev2) (0.29.33)
Requirement already satisfied: tqdm in d:\software\python\lib\site-packages (from openjtalk==0.3.0.dev2) (4.64.1)
Requirement already satisfied: six in d:\software\python\lib\site-packages (from openjtalk==0.3.0.dev2) (1.16.0)
Requirement already satisfied: numpy>=1.20.0 in d:\software\python\lib\site-packages (from openjtalk==0.3.0.dev2) (1.23.3)
Requirement already satisfied: colorama in d:\software\python\lib\site-packages (from tqdm->openjtalk==0.3.0.dev2) (0.4.5)
Installing collected packages: openjtalk
Successfully installed openjtalk-0.3.0.dev2
最大的坑是 Python 如果是是便携版,会报“no Python.h”的错
至于编译环境:
Linux 下可以通过安装 cmake 和 python3-dev 解决
Windows 则需要安装 vs 2022 build tools,选择 C++ 环境安装,最置 cmake/bin 的环境变量即可
附上MSVC链接:https://visualstudio.microsoft.com/zh-hans/visual-cpp-build-tools/
直接安装 openjtalk 确实神奇,没有 pyopenjtalk 的情况下也能在 vits 库引用