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.
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: ''
Open the Registry Editor
and change the type of HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Internet Settings \ ProxyEnable
to REG_BINARY
.
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