As part of our CI testing we install a virtualenv with some pip packages from a constant requirements.txt file.
this installation process randomly fails from time to time with no apparent reason as the requirements.txt file doesn't change. And each time it's for a different random package.
The CI is on an AWS machine so I don't think it can be an internet issue
The failure looks similar to that (with different package failing):
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))
Run Code Online (Sandbox Code Playgroud)
Or
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))
Run Code Online (Sandbox Code Playgroud)
EDIT: Tried adding --timeout 30 --retries 15 which didn't seem to change anything
小智 9
当我有严重依赖时,我会遇到该问题,因此我更新了点子超时并解决了问题。即我的.pip / pip.conf超时为30秒
[global]
timeout = 30
Run Code Online (Sandbox Code Playgroud)
这(from versions: )是一个大提示。它来自pip源代码中的这一行。什么都没有发生的事实versions:意味着pip djanto-rest-auth在pypi索引中找不到任何版本。没关系,您所requirements.txt要求的版本。那张支票稍后送来。
versions:当您尝试安装找不到的东西时,这应该是什么样子:
> pip install django-rest-auth==29.42 # ridiculous version that won't be found
Error: Could not find a version that satisfies the requirement django-rest-auth==29.42
(from versions: 0.9.4.macosx-10.14-intel, 0.1, 0.2, 0.2.1, 0.2.2, 0.2.3, 0.2.4,
0.2.5, 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.4.0, 0.5.0, 0.6.0, 0.7.0, 0.8.0,
0.8.1, 0.8.2, 0.9.0, 0.9.1, 0.9.2, 0.9.3, 0.9.5)
Run Code Online (Sandbox Code Playgroud)
唯一的办法versions:是留空,如果例程find_all_candidates返回一个空列表。find-all-candidates应该返回包含在pypi.org上发布的软件包的每个版本的列表。
我不知道为什么该例程会在您的CI框中随机返回一个空列表,但是我有一个直觉,它涉及将https://pypi.org/simple/django-rest-auth/抓取为链接的代码。也许它偶尔会找回一个空的HTML页面。
您可以执行以下调试操作
--verbose标志运行pip 。这会激活一些可能有用的URL和链接记录。site-packages/pip/_internal/index.py。编辑它并添加更多日志记录以帮助您调试。我将从记录从pypi.org返回的HTML内容开始。pdb进行调试pip。这是您获得的额外日志记录的示例--verbose。真的很奇怪,当您的故障发生时,它是什么样的:
Collecting django-rest-auth==29.42
-------------------------------------------------------
1 location(s) to search for versions of django-rest-auth:
* https://pypi.org/simple/django-rest-auth/
Getting page https://pypi.org/simple/django-rest-auth/
Looking up "https://pypi.org/simple/django-rest-auth/" in the cache
Request header has "max_age" as 0, cache bypassed
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /simple/django-rest-auth/ HTTP/1.1" 200 2467
Updating cache with response from "https://pypi.org/simple/django-rest-auth/"
Caching due to etag
Analyzing links from page https://pypi.org/simple/django-rest-auth/
Found link https://files.pythonhosted.org/packages/c8/ff/cffe8cb7961a1665f20115adb035d23a6b1cb08a2a6c1d6de802b13cdcc9/django-rest-auth-0.1.tar.gz#sha256=fcb9feced7f066c92a5f29f2930609316095a7abe3806e09c3d63c36c3607780 (from https://pypi.org/simple/django-rest-auth/), version: 0.1
Found link https://files.pythonhosted.org/packages/af/d2/5d37d3f1c7055284b969e2de8eaf7d7dc16b51fba94f3325d92d053e12a8/django-rest-auth-0.2.tar.gz#sha256=04ae1a5d991692293ec95a10b517bdb26b41823a645400dc0b899d9f538013b9 (from https://pypi.org/simple/django-rest-auth/), version: 0.2
Found link https://files.pythonhosted.org/packages/46/87/816fcc68a4552916cb82eef40dfd1bd752f831a329e927b96b7f9c6c0db7/django-rest-auth-0.2.1.tar.gz#sha256=3306e739bb8f34d47285c9e1616f75a9d8b4f6985102d68509d5aec5af62c760 (from https://pypi.org/simple/django-rest-auth/), version: 0.2.1
... about 20 more of these
Run Code Online (Sandbox Code Playgroud)
祝好运。抱歉,我无法给您确切的解决方案。
| 归档时间: |
|
| 查看次数: |
652 次 |
| 最近记录: |