Search code examples
pythonwindowspippython-requestsregistry

re.error: missing ), unterminated subpattern at position 0 when installing via pip


i am relatively new to programming, and I ran into a problem. I have installed Python 3.7 and pip 10.0, but when I try to do something such as installing virtualenv, a bunch of error messages appear. I resulted to using easy_install, but the problem using pip is still persistent. My only guess is that maybe some part of pip didn't install properly, but I tried unsuccessfully tried uninstalling and installing again.


Solution

  • The failing code is testing the proxyOverride settings in your computer's registry in HKEY_CURRENT_USER under Software\Microsoft\Windows\CurrentVersion\Internet Settings.

    proxyOverride appears to be a semi-colon-separated string, and apparently one of the values in the string starts with opening parenthesis that is not matched by a closed parenthesis, so something like:

    "ProxyOverride"="(www.foo-;*.bar.com"

    It is this unmatched parenthesis that is causing the error:

    File "c:\users\"name"\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\requests\utils.py", line 74, in proxy_bypass_registry if re.match(test, host, re.I): ... re.error: missing ), unterminated subpattern at position 0

    If your computer is on a network supported by your IT department you should ask them whether the values in the proxyOverride key are valid, and whether the offending parenthesis can be removed.

    If you are your own IT department you could try to edit the registry yourself, but bear in mind that editing the registry should be done with great care, and that you should take a backup of the registry first, and know how to restore the registry from backup if it is required.