From db080bd97954b0a6e408c16a72ad57080b17341a Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Mon, 10 Aug 2020 02:22:12 +0800 Subject: [PATCH] Add block to specifically catch connection errors --- docs/html/user_guide.rst | 5 ++++- src/pip/_internal/index/collector.py | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/html/user_guide.rst b/docs/html/user_guide.rst index 73a2643223b..24291181cee 100644 --- a/docs/html/user_guide.rst +++ b/docs/html/user_guide.rst @@ -788,7 +788,10 @@ archives are built with identical packages. to use such a package, see :ref:`Controlling setup_requires`. -.. _`Using pip from your program`: +Fixing network errors +===================== + +TODO Fixing conflicting dependencies =============================== diff --git a/src/pip/_internal/index/collector.py b/src/pip/_internal/index/collector.py index b86f62f4624..8a253accfef 100644 --- a/src/pip/_internal/index/collector.py +++ b/src/pip/_internal/index/collector.py @@ -460,6 +460,16 @@ def _get_html_page(link, session=None): except SSLError as exc: reason = "There was a problem confirming the ssl certificate" logger.warning("Could not fetch URL %s: %s: %s", link, reason, exc) + except requests.ConnectTimeout: + template = ( + "Skipping URL %s since the connection timed out. This is likely " + "caused by a misconfigured network." + ) + logger.warning(template, link) + logger.warning( + "For help, visit " + "https://pip.pypa.io/en/latest/user_guide/#fixing-network-errors" + ) except requests.ConnectionError as exc: reason = "connection error" logger.warning("Could not fetch URL %s: %s: %s", link, reason, exc)