8
10

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 5 years have passed since last update.

pipでインストール時にエラーが出力される

Last updated at Posted at 2018-08-20

pipでパッケージインストール時にエラーが出力された

pythonのバージョンは「Python 3.6.5」

$ pip install django-oscar
Collecting django-oscar
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)': /packages/4d/32/d84c3fbbb4dd85edb6f2f49c0e91f4bfb25523207a998e3d6f2e4b4e80ee/django_oscar-1.6.4-py2.py3-none-any.whl
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)': /packages/4d/32/d84c3fbbb4dd85edb6f2f49c0e91f4bfb25523207a998e3d6f2e4b4e80ee/django_oscar-1.6.4-py2.py3-none-any.whl
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)': /packages/4d/32/d84c3fbbb4dd85edb6f2f49c0e91f4bfb25523207a998e3d6f2e4b4e80ee/django_oscar-1.6.4-py2.py3-none-any.whl
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)': /packages/4d/32/d84c3fbbb4dd85edb6f2f49c0e91f4bfb25523207a998e3d6f2e4b4e80ee/django_oscar-1.6.4-py2.py3-none-any.whl
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)': /packages/4d/32/d84c3fbbb4dd85edb6f2f49c0e91f4bfb25523207a998e3d6f2e4b4e80ee/django_oscar-1.6.4-py2.py3-none-any.whl
Exception:
Traceback (most recent call last):
  File "/home/kafka/venv/oscar/lib64/python3.6/site-packages/pip/_vendor/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/home/kafka/venv/oscar/lib64/python3.6/site-packages/pip/_vendor/urllib3/connectionpool.py", line 346, in _make_request
    self._validate_conn(conn)
  File "/home/kafka/venv/oscar/lib64/python3.6/site-packages/pip/_vendor/urllib3/connectionpool.py", line 850, in _validate_conn
    conn.connect()
  File "/home/kafka/venv/oscar/lib64/python3.6/site-packages/pip/_vendor/urllib3/connection.py", line 326, in connect
    ssl_context=context)
  File "/home/kafka/venv/oscar/lib64/python3.6/site-packages/pip/_vendor/urllib3/util/ssl_.py", line 329, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/usr/lib64/python3.6/ssl.py", line 407, in wrap_socket
    _context=self, _session=session)
  File "/usr/lib64/python3.6/ssl.py", line 814, in __init__
    self.do_handshake()
  File "/usr/lib64/python3.6/ssl.py", line 1068, in do_handshake
    self._sslobj.do_handshake()
  File "/usr/lib64/python3.6/ssl.py", line 689, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)
(以下略)

参考:pip install fails with “connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)”

SSL認証関連のエラーのようだが細かいところまでは調べてもよくわからない。。。

信頼するホストを設定するといいようなので--trusted-hostオプションを設定して実行する。

$ pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org <name of package>

それでもインストールするパッケージによっては変わらず「certificate verify failed」のエラーが出力されてしまう。

そんな時はPython Package Indexからファイルをダウンロードしてインストールする。

$ wget --no-check-certificate https://files.pythonhosted.org/packages/72/a4/d7a5738a3096f22a98bec1609e237b250ebff04e5ea2930305d485337263/pytest_runner-4.2-py2.py3-none-any.whl
$ pip install pytest_runner-4.2-py2.py3-none-any.whl
8
10
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
8
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?