Normally, installing Numpy in a new venv looks like this for me:
Collecting numpy
Using cached numpy-2.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (60 kB)
Using cached numpy-2.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (19.3 MB)
Installing collected packages: numpy
Successfully installed numpy-2.0.0
This happens much faster than my internet connection would ever possibly support, so I’m confident it’s indeed using a local cache.
But if I’ve disabled my wifi or it has blinked out (as seems to happen quite a bit these days), installation fails, which looks like:
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f8c66a70e20>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/numpy/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f8c66d35180>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/numpy/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f8c66a712d0>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/numpy/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f8c66a71480>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/numpy/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f8c66a71630>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/numpy/
ERROR: Could not find a version that satisfies the requirement numpy (from versions: none)
ERROR: No matching distribution found for numpy
So I presume that normally it’s trying to do some kind of dependency resolution and check what version of Numpy is supported. But couldn’t it at least try to see whether any of the wheels in the local cache would work? That seems a lot more useful than retrying a connection that failed with “Name or service not known” (i.e. we couldn’t even reach DNS).
Similarly, if my Internet is down, and I’m trying to pip wheel .
(or pip install -e .
) a local project that is pure Python and has no dependencies, I don’t think I should need to disable build isolation, just so that Pip will use the Setuptools in its own environment. My ~/.cache/pip
is full of wheels that satisfy setuptools>=40.8.0
by now, I’m sure. Surely it could just use one of them? Or at least consider looking at the corresponding cached metadata?