Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Fresh Python 3.7 64-bit install downloaded from their main website, working on Windows 10 Pro. Using PowerShell with Admin rights. Pip always throws ReadTimeoutError .

The command:

python -m pip -vvv install --upgrade pip

Returns the following:

Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect Created temporary directory: C:\Users\vbfal\AppData\Local\Temp\pip-ephem-wheel-cache-sotpqqgg Created temporary directory: C:\Users\vbfal\AppData\Local\Temp\pip-install-qqmlc7qa 1 location(s) to search for versions of pip: * https://pypi.org/simple/pip/ Getting page https://pypi.org/simple/pip/ Looking up " https://pypi.org/simple/pip/ " in the cache No cache entry available Starting new HTTPS connection (1): pypi.org Incremented Retry for (url='/simple/pip/'): Retry(total=4, connect=None, read=None, redirect=None, status=None) Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pip/ Starting new HTTPS connection (2): pypi.org Incremented Retry for (url='/simple/pip/'): Retry(total=3, connect=None, read=None, redirect=None, status=None) Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pip/ Starting new HTTPS connection (3): pypi.org Incremented Retry for (url='/simple/pip/'): Retry(total=2, connect=None, read=None, redirect=None, status=None) Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pip/ Starting new HTTPS connection (4): pypi.org Incremented Retry for (url='/simple/pip/'): Retry(total=1, connect=None, read=None, redirect=None, status=None) Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pip/ Starting new HTTPS connection (5): pypi.org Incremented Retry for (url='/simple/pip/'): Retry(total=0, connect=None, read=None, redirect=None, status=None) Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pip/ Starting new HTTPS connection (6): pypi.org Could not fetch URL https://pypi.org/simple/pip/ : connection error: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")) - skipping Installed version (10.0.1) is most up-to-date (past versions: none) Requirement already up-to-date: pip in c:\program files\python37\lib\site-packages (10.0.1) Cleaning up... Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect 1 location(s) to search for versions of pip: * https://pypi.org/simple/pip/ Getting page https://pypi.org/simple/pip/ Looking up " https://pypi.org/simple/pip/ " in the cache No cache entry available Starting new HTTPS connection (1): pypi.org Could not fetch URL https://pypi.org/simple/pip/ : connection error: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=5)")) - skipping

I tried pinging pypi and it seemed ok:

Pinging pypi.org [151.101.64.223] with 32 bytes of data: Reply from 151.101.64.223: bytes=32 time=12ms TTL=57 Reply from 151.101.64.223: bytes=32 time=25ms TTL=57 Reply from 151.101.64.223: bytes=32 time=17ms TTL=57 Reply from 151.101.64.223: bytes=32 time=211ms TTL=57

Ping statistics for 151.101.64.223: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 12ms, Maximum = 211ms, Average = 66ms

At first curl to pypi.org seemed to hint at the root cause, returning:

curl : The request was aborted: Could not create SSL/TLS secure channel. At line:1 char:1 + curl pypi.org + ~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

I ran the following to force curl to use TLS 1.2:

[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"

Which then makes curl work (for the session only) returning status 200.

But alas, pip keeps throwing the exact same error message above. I have also tried increasing timeout range to 100 or even to 1000, as suggested in other posts, because, well, Windows... but as expected it only took longer to fail.

Can anyone help me decipher and fix these, please? Thanks a lot!

(Switching to Linux not an option at this time...)

Also, running behind local McAffee firewall... but disabling it doesn't fix the issue either. I have actually used pip before on this computer with the firewall on. Vitor Falleiros Sep 23, 2018 at 2:04 Also also, issue happens in at least two different physical locations (i.e. different internet access, at home and office). Other computers were shown to work with pip at the same moment. Vitor Falleiros Sep 23, 2018 at 3:53

I know this is an old post, but trying to help however is having the same problem.

Fixed this issue by changing the priority from IPv6 to IPv4.

You can try temporarily disable the IPv6 protocol, then try PIP again. If it works, i recommend reactivating IPv6 then searching about IPv4 priority over IPv6, the way to do it changes depending of OS.

Thanks Lin! Indeed old post, at the time it seemed to me that something was corrupted deeper in Windows so I ended up doing some restore on the OS, if I recall correctly, and then reinstalling Python from the ground. Vitor Falleiros Jul 30, 2020 at 20:29

Give precedence to IPv4 over IPv6 (as Lin Chi Yu wrote).
From an elevated command prompt (press "Start", type "CMD", right click on "Command prompt" and select "Run as Administrator"):

netsh interface ipv6 set prefixpolicy ::ffff:0:0/96 46 4
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.