Proxy error when running "pip install"

We will share the errors and solutions that occurred when upgrading the pip library on the PC (Windows10) at work. It seems to occur when accessing the Internet.

environment

Background

I tried to upgrade the pip library on my work PC, but I couldn't upgrade with the following error.

$ python -m pip install --upgrade pip
ERROR: Exception:
Traceback (most recent call last):
  File "C:\Users\yuya_sato\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_internal\cli\base_command.py", line 188, in main
    status = self.run(options, args)
  File "C:\Users\yuya_sato\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_internal\commands\install.py", line 345, in run
    resolver.resolve(requirement_set)
  File "C:\Users\yuya_sato\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_internal\legacy_resolve.py", line 196, in resolve
    self._resolve_one(requirement_set, req)
  File "C:\Users\yuya_sato\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_internal\legacy_resolve.py", line 359, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "C:\Users\yuya_sato\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_internal\legacy_resolve.py", line 297, in _get_abstract_dist_for
    skip_reason = self._check_skip_installed(req)
  File "C:\Users\yuya_sato\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_internal\legacy_resolve.py", line 267, in _check_skip_installed
    self.finder.find_requirement(req_to_install, upgrade=True)
  File "C:\Users\yuya_sato\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_internal\index.py", line 1200, in find_requirement
    candidates = self.find_candidates(
  File "C:\Users\yuya_sato\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_internal\index.py", line 1183, in find_candidates
    candidates = self.find_all_candidates(project_name)
  File "C:\Users\yuya_sato\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_internal\index.py", line 1128, in find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "C:\Users\yuya_sato\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_internal\index.py", line 1282, in _get_pages
    page = _get_html_page(location, session=self.session)
  File "C:\Users\yuya_sato\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_internal\index.py", line 234, in _get_html_page
    resp = _get_html_response(url, session=session)
  File "C:\Users\yuya_sato\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_internal\index.py", line 165, in _get_html_response
    resp = session.get(
  File "C:\Users\yuya_sato\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_vendor\requests\sessions.py", line 546, in get
    return self.request('GET', url, **kwargs)
  File "C:\Users\yuya_sato\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_internal\download.py", line 624, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "C:\Users\yuya_sato\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_vendor\requests\sessions.py", line 523, in request
    settings = self.merge_environment_settings(
  File "C:\Users\yuya_sato\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_vendor\requests\sessions.py", line 700, in merge_environment_settings
    env_proxies = get_environ_proxies(url, no_proxy=no_proxy)
  File "C:\Users\yuya_sato\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_vendor\requests\utils.py", line 761, in get_environ_proxies
    if should_bypass_proxies(url, no_proxy=no_proxy):
  File "C:\Users\yuya_sato\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_vendor\requests\utils.py", line 745, in should_bypass_proxies
    bypass = proxy_bypass(parsed.hostname)
  File "C:\Users\yuya_sato\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_vendor\requests\utils.py", line 95, in proxy_bypass
    return proxy_bypass_registry(host)
  File "C:\Users\yuya_sato\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_vendor\requests\utils.py", line 60, in proxy_bypass_registry
    proxyEnable = int(winreg.QueryValueEx(internetSettings,
ValueError: invalid literal for int() with base 10: ''

Solution

Open the Registry Editor and change the type of HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Internet Settings \ ProxyEnable to REG_BINARY.

Finally

I'm not very familiar with this area, so it's still unclear why this solution works. However, since this error occurs frequently, I wrote an article including the meaning of recording to myself.

By the way, it has never occurred on a personal computer (Mac OS).

Recommended Posts

Proxy error when running "pip install"
Error with pip install
When pip install fails
Eliminates SSL error when PIP Install on Windows.
When moss with pip install
Pip install in proxy environment
Pip install (Windows) under Proxy environment
When pip fails under proxy environment
pip install prevents proxy from installing
Yara error when running Cuckoo Sandbox
# Solution when pip install gives an error when using Anaconda on Windows 10
SSL certificate related with pip install? Error
Solution for pip install error [Python] [Mac]
In pip install clang: error: unknown argument:'-mno-fused-madd'
sudo pip install
fatal error: Python.h: no such files or directories when pip3 install psutil
Error when installing a module with Python pip
Pip install a private repository when building Docker
Proxy settings when using pip or Jupyter Notebook
Error when trying to install psycopg2 in Python
Workaround if you get an error when trying to install PySide with pip
Install pip on Mavericks
Install pip, pyenv, BeautifulSoup4
pip install ○○○ error Command errored out with exit status 1:
How to install pip
I got a UnicodeDecodeError when pip install on ubuntu
Install the pip command
For those who are in trouble with an error when pip install xg boost
I got an error when pip install pandas on Mac, so I dealt with it
Install pip / pip3 on Ubuntu
Install scikit.learn with pip
[Small story] How to install the module when pip cannot be used due to proxy etc.
I got an error when pip install tweepy on macOS Sierra, so I dealt with it
Install Jupiter Notebook on Windows with pip in proxy environment
Solution memo when "ERROR: Command errored out with exit status 1:" is displayed in pip install hogehoge
Enable CentOS 6 pip via Proxy
When pyenv install BUILD FAILED
Install github repository with pip
Pip install the GitHub repository
Error when playing with python
polyfit error when installing matplotlib
Dealing with PermissionError [Error 1] for pip install -U pip on macOS Sierra