Artrajz / vits-simple-api

A simple VITS HTTP API, developed by extending Moegoe with additional features.
GNU Affero General Public License v3.0
822 stars 121 forks source link

本地环境 pip install 安装时间太久, 似乎陷入死循环 #143

Closed YutingYou closed 9 months ago

YutingYou commented 9 months ago

运行环境

问题描述

requirements.txt 中的包版本未使用固定版本, 导致 pip install -r requirements.txt 每安装一个包都要循环检测版本依赖是否满足, 耗时很久且无法完成安装

Collecting tokenizers==0.0.11 (from transformers->-r requirements.txt (line 29))
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/6c/51/0eb780144128a7e7e108b507077b3a8099c908a8f5c1942db07cd8c312d1/tokenizers-0.0.11.tar.gz (30 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting transformers (from -r requirements.txt (line 29))
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/c6/38/c30b6a4b86705311c428a234ef752f6c4c4ffdd75422a829f1f2766136c3/transformers-2.4.0-py3-none-any.whl (475 kB)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/50/10/aeefced99c8a59d828a92cc11d213e2743212d3641c87c82d61b035a7d5c/transformers-2.3.0-py3-none-any.whl (447 kB)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/d1/08/4a6768ca1a7a4fa37e5ee08077c5d02b8d83876bd36caa5fc24d98992ac2/transformers-2.2.2-py3-none-any.whl (387 kB)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/70/1a/364556102943cacde1ee00fdcae3b1615b39e52649eddbf54953e5b144c9/transformers-2.2.1-py3-none-any.whl (364 kB)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/ec/e7/0a1babead1b79afabb654fbec0a052e0d833ba4205a6dfd98b1aeda9c82e/transformers-2.2.0-py3-none-any.whl (360 kB)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/fd/f9/51824e40f0a23a49eab4fcaa45c1c797cbf9761adedd0b558dab7c958b34/transformers-2.1.1-py3-none-any.whl (311 kB)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/5f/e5/4fb8a6215608c4036b6dd16613268a4b8958c20e4249d141e621e7f2e146/transformers-2.1.0-py3-none-any.whl (313 kB)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/66/99/ca0e4c35ccde7d290de3c9c236d5629d1879b04927e5ace9bd6d9183e236/transformers-2.0.0-py3-none-any.whl (290 kB)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/01/19/63ad9650d96d35b380540372216276cdda14eb506877c28865c36338a137/transformers-0.1.tar.gz (2.3 kB)
  Preparing metadata (setup.py) ... done
Collecting langid (from -r requirements.txt (line 27))
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/ea/4c/0fb7d900d3b0b9c8703be316fbddffecdab23c64e1b46c7a83561d78bd43/langid-1.1.6.tar.gz (1.9 MB)
  Preparing metadata (setup.py) ... done

问题复现步骤

  1. pyenv 创建一个虚拟环境, 使用版本 3.11
  2. 执行 pip install -r requirements.txt 观察安装速度

建议

每次发布一个版本, 能否更新一下 requirements.txt 指定使用固定版本的依赖包, 这样可以避免 pip 自己检查占用时间

Artrajz commented 9 months ago

推荐使用python 3.10,我也使用3.11复现了该问题,但是尝试使用3.10可以用的第三方库版本,来固定版本后,最终导致多个包冲突 🤣 。如果能找到同时支持3.10和3.11第三方库版本,也欢迎pr~

YutingYou commented 9 months ago

@Artrajz 谢谢, 我先切到 3.10 上试试, 最好在文档上提示一下

另外 MacBook Pro M1 上使用 docker 运行也失败了, 似乎无法正确识别 CPU

vits-simple-api-vits-1  |     return _bootstrap._gcd_import(name[level:], package, level)
vits-simple-api-vits-1  |   File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
vits-simple-api-vits-1  |   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
vits-simple-api-vits-1  |   File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
vits-simple-api-vits-1  |   File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
vits-simple-api-vits-1  |   File "<frozen importlib._bootstrap_external>", line 883, in exec_module
vits-simple-api-vits-1  |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
vits-simple-api-vits-1  |   File "/app/app.py", line 10, in <module>
vits-simple-api-vits-1  |     from tts_app.frontend.views import frontend
vits-simple-api-vits-1  |   File "/app/tts_app/frontend/views.py", line 3, in <module>
vits-simple-api-vits-1  |     from tts_app.model_manager import model_manager
vits-simple-api-vits-1  |   File "/app/tts_app/model_manager.py", line 9, in <module>
vits-simple-api-vits-1  |     model_manager.model_init()
vits-simple-api-vits-1  |   File "/app/manager/ModelManager.py", line 91, in model_init
vits-simple-api-vits-1  |     self.log_device_info()
vits-simple-api-vits-1  |   File "/app/manager/ModelManager.py", line 161, in log_device_info
vits-simple-api-vits-1  |     cpu_name = cpu_info['brand_raw']
vits-simple-api-vits-1  | KeyError: 'brand_raw'
Artrajz commented 9 months ago

已修,由于手头上没有mac设备进行测试,暂且将cpu_name无法获取时设置为None。

其实在文档开头放了个3.10的图标,不过可能不太明显,那就在下面部署的地方再提示一次吧~