SSL Issue while installing any package using pip behind the proxy

独自空忆成欢 提交于 2019-12-24 17:12:11

问题


Facing issues while installing tensorflow or any other package behind the proxy :

First try :

Run the command :

pip install --upgrade tensorflow

Output :

Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was
 forcibly closed by the remote host', None, 10054, None))': /simple/tensorflow/

Second try :

Then I provided the proxy details along with the command

>pip install --upgrade tensorflow --proxy http://user:passwd@xxx.xx.x.xx:80

Output error :

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:83
3)'),)': /simple/tensorflow/

Third try as suggested on pip install fails with "connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)":

pip install --upgrade tensorflow --trusted-host pypi.org --trusted-host files.pythonhosted.org --proxy http://user:passwd@xxx.xx.x.xx:80

Output :

Same as above.

Can anyone help ??

edit : working on windows machine


回答1:


I would suspect that you might need to set your proxy environment variables on your machine to use your proxy. Try setting the following (assumming your on a Linux or Mac OS):

export HTTP_PROXY=http://user:passwd@xxx.xx.x.xx:80
export HTTPS_PROXY=https://user:passwd@xxx.xx.x.xx:443

You don't necessarily need to set the HTTPS_PROXY variable but it can't hurt to do so

Then try running without the flags

pip install tensorflow



回答2:


I had a similar issue after some update mix-ups between pip and apt. Following the suggestions on some SO page that I don't recall I've launched

sudo python -m easy_install --upgrade pyOpenSSL 

and got the things running again.

LE: might've misread the problem.



来源:https://stackoverflow.com/questions/51077804/ssl-issue-while-installing-any-package-using-pip-behind-the-proxy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!