1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

"pip install"実行時のプロキシエラー

Posted at

仕事場のPC(Windows10)にて、pipライブラリアップグレード時発生したエラー・解決方法について共有します。
インターネットへアクセスする時に発生するようです。

環境

  • Windows 10 Pro 1903
  • Python 3.8.0
  • pip 19.2.3

経緯

仕事場のPCにて、pipライブラリのアップグレードしようとしましたが、以下のエラーが出てアップグレードが出来ませんでした。

$ 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: ''

解決方法

Registry Editor開いて、HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnableの型をREG_BINARYに変更。

最後に

ここら辺はあまり詳しくないので、この解決方法がなぜ有効なのかはもやもやのままです。
只、このエラーがたびたび発生するので自分への記録の意味も含めて記事書きました。

ちなみに私物PC(Mac OS)では発生したことないです。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?