'Python WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None))
I'm trying to do pip install --upgrade pip and keep
getting this error:
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnection
Error('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000026F50B448C8>: Failed to establish a new connection: [WinError 10061] No connection could be made
because the target machine actively refused it'))': /simple/pytest/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnection
Error('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000026F50B59148>: Failed to establish a new connection: [WinError 10061] No connection could be made
because the target machine actively refused it'))': /simple/pytest/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnection
Error('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000026F50B596C8>: Failed to establish a new connection: [WinError 10061] No connection could be made
because the target machine actively refused it'))': /simple/pytest/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnection
Error('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000026F50B595C8>: Failed to establish a new connection: [WinError 10061] No connection could be made
because the target machine actively refused it'))': /simple/pytest/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnection
Error('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000026F50B5F2C8>: Failed to establish a new connection: [WinError 10061] No connection could be made
because the target machine actively refused it'))': /simple/pytest/
ERROR: Could not find a version that satisfies the requirement pytest
ERROR: No matching distribution found for pytest
Also, I can't install any new package due to this error.
I tried to reinstall Pycharm but no luck there.
I tried some other suggested solutions online - still no luck.
I understand it has something to do with Proxy but I am not familiar with it, Anyone?
Solution 1:[1]
Try appending your build command with --network=host
Eg : docker build -t cointainer_name . --network=host
If you use the host network mode for a container, that container’s network stack is not isolated from the
Docker host (the container shares the host’s networking namespace), and the container does not
get its own IP-address allocated.
For instance, if you run a container which binds to port 80 and you use host
networking, the container’s application is available on port 80 on the host’s IP address.
Check here for more details
Solution 2:[2]
First, reinstalling all python. Secondly, once python is installed I went to find the host file and uncomment the section of the host. Normally, the path in windows is located in C:\Windows\System32\drivers\etc
Uncomment this section:
localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
::1 localhost
Hope it serves! cheers!
Solution 3:[3]
TL;DR for Windows, this works for me.
Windows+I(to open Settings).- Choose
Network & Internet - Choose
Proxy - Check
Manual proxy setupto be in theOff-position
---all starts to work here already---
- Note:
Automatically detect settingsswitched toOnor toOffcause no influence for me (all still continue to work as it started to work after 4.).
Pre-story
I had the same error. Can't install libs by
pip, bypipenv, by anaconda, by PyCharm. Then I checkedProxysetting (Windows 11 OS) and noticed I have someManual proxy setupdefined. When disable it - the problem was fixed.
The problem began very spontaneously: I did some python-work, did some installations (maybe some pithon-module with
pipenvlike notebook or jupyter-lab,cygwintool etc.) and then installing/updating of the python-modules was crashed. Maybe some installations changed the proxy-parameters? I don't know.
Python re-installing didn't help.
Errors examples
For example, anaconda error while installing/updating looks like:
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/win-64/current_repodata.json>
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
If your current network has https://www.anaconda.com blocked, please file
a support request with your network engineering team.
'https://repo.anaconda.com/pkgs/main/win-64'
Pip error while installing/updating looks like:
pip install --upgrade pip
>>>
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/pip/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/pip/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/pip/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/pip/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/pip/
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | cryptoKTM |
| Solution 2 | Cristian Fernando Rodriguez |
| Solution 3 | dmitmatveev |
