python - PIP 随机失败 'Could not find a version that satisfies the requirement' 相同要求.txt

标签 python pip

作为 CI 测试的一部分,我们安装了一个 virtualenv,其中包含来自常量 requirements.txt 文件的一些 pip 包。

由于 requirements.txt 文件未更改,此安装过程有时会随机失败,原因不明。并且每次都是针对不同的随机包。

CI 在 AWS 机器上,所以我认为这不是互联网问题

失败看起来类似于(不同的包失败):

Collecting django-rest-auth==0.9.3 (from -r requirements.txt (line 7))
Could not find a version that satisfies the requirement django-rest-auth==0.9.3 (from -r requirements.txt (line 7)) (from versions: )
No matching distribution found for django-rest-auth==0.9.3 (from -r requirements.txt (line 7))

或者

Collecting py>=1.5.0 (from pytest->-r requirements.txt (line 15))
Could not find a version that satisfies the requirement py>=1.5.0 (from pytest->-r requirements.txt (line 15)) (from versions: )
No matching distribution found for py>=1.5.0 (from pytest->-r requirements.txt (line 15))

编辑:尝试添加 --timeout 30 --retries 15 似乎没有任何改变

最佳答案

当我有严重的依赖性时,我会遇到这个问题,所以我更新了 pip 的超时时间,问题就解决了。即我的 .pip/pip.conf 有 30 秒的超时

[global]
timeout = 30

关于python - PIP 随机失败 'Could not find a version that satisfies the requirement' 相同要求.txt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56596752/

相关文章:

python - 仅使用单个目标复制 waf 中的多个文件

python - 为什么在尝试设置 virtualenv 时出现此错误(与 pip 和 easy_install 相关)?

python - pip 找不到tensorflow-gpu 2.0-alpha

python - 在 Django 中检索图像

python - Pip 安装到 python3.6 但我在 Ubuntu 18.04 上使用 python3.7 和 VS Code

python - 当 pip 和 conda 重叠时该怎么办?

python - 如何根据需要从 Python 脚本自动安装所需的包?

python - 在 self._compute_kernel(X) 中引发 ValueError ("X.shape[0] should be equal to X.shape[1]")

python - SQLAlchemy 使用单个数据库查询更新多个对象上的多个字段

python - 使用矩阵乘法对矩阵进行高效切片,使用 Python、NumPy、SciPy