openai-whisper安装失败No module named 'pkg_resources'
我在安装环境时,执行到openai-whisper==20231117,出现下面报错,尝试升级pip install -U pip setuptools wheel,还是不行,请大佬解答一下
Collecting openai-whisper==20231117 (from -r requirements.txt (line 25)) Downloading https://mirrors.aliyun.com/pypi/packages/d2/6e/50ace2bf704e5ffc786d20d96403ab0d57c5d6ab8729de7fed8c436687df/openai-whisper-20231117.tar.gz (798 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 798.6/798.6 kB 2.5 MB/s 0:00:00 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
╰─> [17 lines of output]
Traceback (most recent call last):
File "/home/yishan/miniconda3/envs/cosyvoice/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in
note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed to build 'openai-whisper' when getting requirements to build wheel
可以检查下setuptools 版本,最新 setuptools >= 82 不再支持 pkg_resources https://github.com/pypa/setuptools/issues/5174
尝试下面的命令
pip install "setuptools==81.0.0" -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com
pip install openai-whisper==20231117 --no-build-isolation -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com
可以检查下setuptools 版本,最新 setuptools >= 82 不再支持 pkg_resources pypa/setuptools#5174
尝试下面的命令
pip install "setuptools==81.0.0" -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com pip install openai-whisper==20231117 --no-build-isolation -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com
不好用呀佬,我window11+WSL2环境,执行第二条安装命令的时候下载了几十个版本的pytorch,给我磁盘都下满了
@chiexplorer 我也跟你一样 pip install "setuptools==81.0.0" -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com pip install openai-whisper==20231117 --no-build-isolation -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com 执行第二条安装命令的时候,一直下载了几十个版本的pytorch,一直执行停不下来,请大佬帮忙看看
openai-whisper 放在最后安装。当时的操作顺序是:
- 先注释掉 requirements.txt 里的 openai-whisper==20231117 这一行
- 然后 pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com
- 最后再单独运行
pip install "setuptools==81.0.0" -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com
pip install openai-whisper==20231117 --no-build-isolation -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com
先 pip install -r requirements.txt 应该会把 pytorch 直接安装好,这样安装 openai-whisper 的时候不会重新安装 pytorch 依赖
我是这样处理,创建文件build-constraints.txt内容:
setuptools>=45,<80
运行命令:
pip install --build-constraint build-constraints.txt -r requirements.txt
This issue is stale because it has been open for 30 days with no activity.
这么安装pip install openai-whisper==20231117 -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com --no-cache-dir --no-build-isolation
注意--no-build-isolation,原理我就不解释了,有兴趣自行百度。
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.