diff --git a/news/4473.feature b/news/4473.feature new file mode 100644 index 00000000000..5e93d322496 --- /dev/null +++ b/news/4473.feature @@ -0,0 +1,4 @@ +pip now retries on more HTTP status codes, for intermittent failures. + +Previously, it only retried on the standard 503. Now, it also retries on 500 +(transient failures on AWS S3), 520 and 527 (transient failures on Cloudflare). diff --git a/src/pip/_internal/download.py b/src/pip/_internal/download.py index 621dea7e3ce..180ea77bfaf 100644 --- a/src/pip/_internal/download.py +++ b/src/pip/_internal/download.py @@ -348,7 +348,9 @@ def __init__(self, *args, **kwargs): # connection got interrupted in some way. A 503 error in general # is typically considered a transient error so we'll go ahead and # retry it. - status_forcelist=[503], + # A 500 may indicate transient errror in Amazon S3 + # A 520 or 527 - may indicate transient errror in CloudFlare + status_forcelist=[500, 503, 520, 527], # Add a small amount of back off between failed requests in # order to prevent hammering the service.