'PIP install and Python requests get PermissionError on Windows

Search all over the internet, thread after thread tried every solution possible almost 2 days and can't find solution. I have already tried to reinstall python and pip.

I've tried running the scripts via cmd as Admin and still nothing.

The problem is that i can't make any othside requests, can't install pip packages, basicly my py is isolatated.

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', PermissionError(13, 'Permission denied'))': /simple/pypdf2/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', PermissionError(13, 'Permission denied'))': /simple/pypdf2/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', PermissionError(13, 'Permission denied'))': /simple/pypdf2/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', PermissionError(13, 'Permission denied'))': /simple/pypdf2/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', PermissionError(13, 'Permission denied'))': /simple/pypdf2/
ERROR: Could not find a version that satisfies the requirement pypdf2 (from versions: none)
ERROR: No matching distribution found for pypdf2

another example, The code is very simple:

import requests
new_lines = requests.get('https://api...')

the error i get is:

  File "C:\Users\OPS\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "C:\Users\OPS\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Users\OPS\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\OPS\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\sessions.py", line 645, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\OPS\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\adapters.py", line 501, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', PermissionError(13, 'Permission denied'))

both have the:

('Connection aborted.', PermissionError(13, 'Permission denied'))

And cant make any outside request does't matter to which server/web/anything.

Using windows 10 python 3.10 pip 22.0.4 I've installed docker, WSL2, Chocolatey Which all of them had some kind of powershell manipulation.



Solution 1:[1]

Confirmed this is a bug in python 3.10 - 3.8 i've tried everything, disable antivirus removed every software. every python version install in different locations, checked the regedit, checked the powershell permission conf, it's just bug in python. 3.10.4, 30.10, 30.9, 30.8 is not working for me. only python 3.7.4. i just downgraded to python 3.7.4 and pip work like a charm. also the requests module works great nothing get's blocked.

The problem is it an old version... and alot of my projects need a newer one. Switching to mac, windows is shit.

https://bugs.python.org/msg378892

https://github.com/python/cpython/issues/86238

The answer i've found: https://geeksqa.com/pip-install-fails-with-protocolerror-connection-aborted-permissionerror-13-permission-denied

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