2017-07-01 41 views
0

これは、ubuntu 16.04を使用した新しいサーバーです。私はいくつかの他のubuntuサーバーをオンラインにしています。なぜこれが起こったのか分かりません。pipインストールパッケージを使用するとsslエラーが発生する

私は "pip install --index-url = http://pypi.python.org/simple/ --trusted-host pypi.python.orgリクエスト"、 "pip --cert GlobalSign_Root_CA.pemインストールリクエスト"、 "pip --cert DigiCert_Global_Root_CA"を試しました。 「pemインストール要求」を参照してください。このエラーは解決しませんでした。カール

[email protected]:~# curl https://api.ipify.org/ 
curl: (35) gnutls_handshake() failed: The TLS connection was non-properly terminated. 
[email protected]:~# curl http://api.ipify.org/ 
curl: (52) Empty reply from server 
[email protected]:~# curl https://pypi.python.org 
curl: (35) gnutls_handshake() failed: The TLS connection was non-properly terminated. 
[email protected]:~# curl http://pypi.python.org 
curl: (52) Empty reply from server 

ubuntu 16.04 

pip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7) 

いくつかのテスト結果は同じSSLの問題は、apt-getの更新に一度起こりました。すべての新しいubuntuがインストールされた後には消えてしまいましたが、pip sslエラーが発生しました。 apt-getの更新

[email protected]:~# sudo apt-get update 
Hit:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial InRelease 
Get:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates InRelease [102 kB] 
Get:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-backports InRelease [102 kB] 
Get:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security InRelease [102 kB] 
Get:5 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates/main amd64 Packages [572 kB] 
Get:6 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates/main i386 Packages [552 kB] 
Get:7 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates/universe amd64 Packages [490 kB] 
Get:8 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates/universe i386 Packages [472 kB] 
Fetched 2,393 kB in 4s (535 kB/s)       
Reading package lists... Done 

ピップ--cert GlobalSign_Root_CA.pemと

更新結果が

Collecting requests 
Exception: 
Traceback (most recent call last): 
    File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 209, in main 
    status = self.run(options, args) 
    File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 328, in run 
    wb.build(autobuilding=True) 
    File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 748, in build 
    self.requirement_set.prepare_files(self.finder) 
    File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 360, in prepare_files 
    ignore_dependencies=self.ignore_dependencies)) 
    File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 512, in _prepare_file 
    finder, self.upgrade, require_hashes) 
    File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 273, in populate_link 
    self.link = finder.find_requirement(self, upgrade) 
    File "/usr/lib/python2.7/dist-packages/pip/index.py", line 442, in find_requirement 
    all_candidates = self.find_all_candidates(req.name) 
    File "/usr/lib/python2.7/dist-packages/pip/index.py", line 400, in find_all_candidates 
    for page in self._get_pages(url_locations, project_name): 
    File "/usr/lib/python2.7/dist-packages/pip/index.py", line 545, in _get_pages 
    page = self._get_page(location) 
    File "/usr/lib/python2.7/dist-packages/pip/index.py", line 648, in _get_page 
    return HTMLPage.get_page(link, session=self.session) 
    File "/usr/lib/python2.7/dist-packages/pip/index.py", line 757, in get_page 
    "Cache-Control": "max-age=600", 
    File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 480, in get 
    return self.request('GET', url, **kwargs) 
    File "/usr/lib/python2.7/dist-packages/pip/download.py", line 378, in request 
    return super(PipSession, self).request(method, url, *args, **kwargs) 
    File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 468, in request 
    resp = self.send(prep, **send_kwargs) 
    File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 576, in send 
    r = adapter.send(request, **kwargs) 
    File "/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/adapter.py", line 46, in send 
    resp = super(CacheControlAdapter, self).send(request, **kw) 
    File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/adapters.py", line 376, in send 
    timeout=timeout 
    File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 610, in urlopen 
    _stacktrace=sys.exc_info()[2]) 
    File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 228, in increment 
    total -= 1 
TypeError: unsupported operand type(s) for -=: 'Retry' and 'int' 

ピップ検索が

Exception: 
Traceback (most recent call last): 
    File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 209, in main 
    status = self.run(options, args) 
    File "/usr/lib/python2.7/dist-packages/pip/commands/search.py", line 43, in run 
    pypi_hits = self.search(query, options) 
    File "/usr/lib/python2.7/dist-packages/pip/commands/search.py", line 60, in search 
    hits = pypi.search({'name': query, 'summary': query}, 'or') 
    File "/usr/lib/python2.7/xmlrpclib.py", line 1243, in __call__ 
    return self.__send(self.__name, args) 
    File "/usr/lib/python2.7/xmlrpclib.py", line 1602, in __request 
    verbose=self.__verbose 
    File "/usr/lib/python2.7/dist-packages/pip/download.py", line 764, in request 
    headers=headers, stream=True) 
    File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 511, in post 
    return self.request('POST', url, data=data, json=json, **kwargs) 
    File "/usr/lib/python2.7/dist-packages/pip/download.py", line 378, in request 
    return super(PipSession, self).request(method, url, *args, **kwargs) 
    File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 468, in request 
    resp = self.send(prep, **send_kwargs) 
    File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 576, in send 
    r = adapter.send(request, **kwargs) 
    File "/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/adapter.py", line 46, in send 
    resp = super(CacheControlAdapter, self).send(request, **kw) 
    File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/adapters.py", line 447, in send 
    raise SSLError(e, request=request) 
SSLError: EOF occurred in violation of protocol (_ssl.c:590) 

が-vvvが

を要求インストールPIP要求リクエストをインストール
Converted retries value: Retry(total=5, connect=None, read=None, redirect=None) -> Retry(total=Retry(total=5, connect=None, read=None, redirect=None), connect=None, read=None, redirect=None) 
Converted retries value: Retry(total=5, connect=None, read=None, redirect=None) -> Retry(total=Retry(total=5, connect=None, read=None, redirect=None), connect=None, read=None, redirect=None) 
Collecting requests 
    1 location(s) to search for versions of requests: 
    * https://pypi.python.org/simple/requests/ 
    Getting page https://pypi.python.org/simple/requests/ 
    Starting new HTTPS connection (1): pypi.python.org 
    Could not fetch URL https://pypi.python.org/simple/requests/: connection error: EOF occurred in violation of protocol (_ssl.c:645) - skipping 
    Could not find a version that satisfies the requirement requests (from versions:) 
Cleaning up... 
No matching distribution found for requests 
Exception information: 
Traceback (most recent call last): 
    File "/root/code/nlp/.env/lib/python3.5/site-packages/pip/basecommand.py", line 209, in main 
    status = self.run(options, args) 
    File "/root/code/nlp/.env/lib/python3.5/site-packages/pip/commands/install.py", line 328, in run 
    wb.build(autobuilding=True) 
    File "/root/code/nlp/.env/lib/python3.5/site-packages/pip/wheel.py", line 748, in build 
    self.requirement_set.prepare_files(self.finder) 
    File "/root/code/nlp/.env/lib/python3.5/site-packages/pip/req/req_set.py", line 360, in prepare_files 
    ignore_dependencies=self.ignore_dependencies)) 
    File "/root/code/nlp/.env/lib/python3.5/site-packages/pip/req/req_set.py", line 512, in _prepare_file 
    finder, self.upgrade, require_hashes) 
    File "/root/code/nlp/.env/lib/python3.5/site-packages/pip/req/req_install.py", line 273, in populate_link 
    self.link = finder.find_requirement(self, upgrade) 
    File "/root/code/nlp/.env/lib/python3.5/site-packages/pip/index.py", line 491, in find_requirement 
    'No matching distribution found for %s' % req 
pip.exceptions.DistributionNotFound: No matching distribution found for requests 
Converted retries value: Retry(total=0, connect=None, read=None, redirect=None) -> Retry(total=Retry(total=0, connect=None, read=None, redirect=None), connect=None, read=None, redirect=None) 
Converted retries value: Retry(total=0, connect=None, read=None, redirect=None) -> Retry(total=Retry(total=0, connect=None, read=None, redirect=None), connect=None, read=None, redirect=None) 
Starting new HTTPS connection (1): pypi.python.org 
There was an error checking the latest version of pip 
Traceback (most recent call last): 
    File "/root/code/nlp/.env/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 560, in urlopen 
    body=body, headers=headers) 
    File "/root/code/nlp/.env/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 346, in _make_request 
    self._validate_conn(conn) 
    File "/root/code/nlp/.env/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 787, in _validate_conn 
    conn.connect() 
    File "/root/code/nlp/.env/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connection.py", line 252, in connect 
    ssl_version=resolved_ssl_version) 
    File "/root/code/nlp/.env/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/util/ssl_.py", line 305, in ssl_wrap_socket 
    return context.wrap_socket(sock, server_hostname=server_hostname) 
    File "/usr/lib/python3.5/ssl.py", line 377, in wrap_socket 
    _context=self) 
    File "/usr/lib/python3.5/ssl.py", line 752, in __init__ 
    self.do_handshake() 
    File "/usr/lib/python3.5/ssl.py", line 988, in do_handshake 
    self._sslobj.do_handshake() 
    File "/usr/lib/python3.5/ssl.py", line 633, in do_handshake 
    self._sslobj.do_handshake() 
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:645) 

During handling of the above exception, another exception occurred: 

Traceback (most recent call last): 
    File "/root/code/nlp/.env/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/adapters.py", line 376, in send 
    timeout=timeout 
    File "/root/code/nlp/.env/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 589, in urlopen 
    raise SSLError(e) 
requests.packages.urllib3.exceptions.SSLError: EOF occurred in violation of protocol (_ssl.c:645) 

During handling of the above exception, another exception occurred: 

Traceback (most recent call last): 
    File "/root/code/nlp/.env/lib/python3.5/site-packages/pip/utils/outdated.py", line 126, in pip_version_check 
    headers={"Accept": "application/json"}, 
    File "/root/code/nlp/.env/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 480, in get 
    return self.request('GET', url, **kwargs) 
    File "/root/code/nlp/.env/lib/python3.5/site-packages/pip/download.py", line 378, in request 
    return super(PipSession, self).request(method, url, *args, **kwargs) 
    File "/root/code/nlp/.env/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 468, in request 
    resp = self.send(prep, **send_kwargs) 
    File "/root/code/nlp/.env/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 576, in send 
    r = adapter.send(request, **kwargs) 
    File "/root/code/nlp/.env/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/adapter.py", line 46, in send 
    resp = super(CacheControlAdapter, self).send(request, **kw) 
    File "/root/code/nlp/.env/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/adapters.py", line 447, in send 
    raise SSLError(e, request=request) 
requests.exceptions.SSLError: EOF occurred in violation of protocol (_ssl.c:645) 
+0

非pipプログラム(例: 'curl')はこのサーバーからhttps://pypi.python.orgに問題なく接続できますか? – jwodder

+0

カールのあるテスト結果 root @ ubuntu:〜curl https://api.ipify.org/ curl:(35)gnutls_handshake()failed:TLS接続が正常に終了しませんでした。 root @ ubuntu:〜#curl http://api.ipify.org/ curl:(52)サーバーからの空の返信 root @ ubuntu:〜#curl https://pypi.python.org curl:(35) )gnutls_handshake()failed:TLS接続が正しく終了しませんでした。 ルート@ ubuntu:〜#curl http://pypi.python.org curl:(52)サーバーからの空の返信 –

+0

@jwodderありがとう。私のルーターのシャドーソックスの設定が間違っているため、修正されています。 –

答えて

0

私のルーターでシャドーソックスが誤って設定されているため、修正されています。

関連する問題