[英]SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate)'
Hi i am having issue while building python image嗨,我在构建 python 映像时遇到问题
Error says,错误说,
> [8/9] RUN pip install -r requirements.txt:
#12 9.084 Collecting azure-iot-device~=2.0.0
#12 9.262 WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1091)'))': /packages/3f/a2/380aa87ade47fcdc8b39503bb36f0a3ab16a9667b7134219b021c2ae5633/azure_iot_device-2.0.1-py2.py3-none-any.whl
#12 9.886 WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1091)'))': /packages/3f/a2/380aa87ade47fcdc8b39503bb36f0a3ab16a9667b7134219b021c2ae5633/azure_iot_device-2.0.1-py2.py3-none-any.whl
#12 11.01 WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1091)'))': /packages/3f/a2/380aa87ade47fcdc8b39503bb36f0a3ab16a9667b7134219b021c2ae5633/azure_iot_device-2.0.1-py2.py3-none-any.whl
#12 13.15 WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1091)'))': /packages/3f/a2/380aa87ade47fcdc8b39503bb36f0a3ab16a9667b7134219b021c2ae5633/azure_iot_device-2.0.1-py2.py3-none-any.whl
#12 17.32 WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1091)'))': /packages/3f/a2/380aa87ade47fcdc8b39503bb36f0a3ab16a9667b7134219b021c2ae5633/azure_iot_device-2.0.1-py2.py3-none-any.whl
#12 17.49 ERROR: Could not install packages due to an OSError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/3f/a2/380aa87ade47fcdc8b39503bb36f0a3ab16a9667b7134219b021c2ae5633/azure_iot_device-2.0.1-py2.py3-none-any.whl (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1091)')))
#12 17.49
#12 19.10 WARNING: You are using pip version 21.0.1; however, version 21.1 is available.
#12 19.10 You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
------
executor failed running [/bin/sh -c pip install -r requirements.txt]: exit code: 1
But when upgarding pip, same error shows.但是在升级 pip 时,会出现同样的错误。
ERROR: Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/ac/cf/0cc542fc93de2f3b9b53cb979c7d1118cffb93204afb46299a9f858e113f/pip-21.1-py3-none-any.whl (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)')))
ERROR: Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/ac/cf/0cc542fc93de2f3b9b53cb979c7d1118cffb93204afb46299a9f858e113f/pip-21.1-py3-none -any.whl(由 SSLError(SSLCertVerificationError(1,'[SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败:无法获取本地颁发者证书(_ssl.c:1123)')引起))
I tried, RUN pip install --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org -r requirements.txt, in my docker file but its not helping me.我试过了,在我的 Z05B60533B151A2DA4EZ68 文件中运行 pip install --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org -r requirements.txt帮我。
I tried, uninstalling all python interpreter and reinstalling but same result.我试过,卸载所有 python 解释器并重新安装但结果相同。
We are not using proxy server and i can ping files.pythonhosted.org properly我们没有使用代理服务器,我可以正确 ping files.pythonhosted.org
Hope you someone can help me on this.希望有人可以帮助我。 Thank you.
谢谢你。
Verify if certs are in place.验证证书是否到位。
~ $ python3.7 -c "import ssl; print(ssl.get_default_verify_paths())"
DefaultVerifyPaths(
cafile='/etc/pki/tls/cert.pem',
capath='/etc/pki/tls/certs',
openssl_cafile_env='SSL_CERT_FILE',
openssl_cafile='/etc/pki/tls/cert.pem',
openssl_capath_env='SSL_CERT_DIR',
openssl_capath='/etc/pki/tls/certs')
you could try add trusted-host as below like this.您可以尝试像下面这样添加受信任的主机。
pip install -r requirements.txt --trusted-host files.pythonhosted.org --trusted-host pypi.org --trusted-host pypi.python.org
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.