EnvironmentError: HTTPSConnectionPool 同时在 docker 容器上安装 pip

Posted

技术标签:

【中文标题】EnvironmentError: HTTPSConnectionPool 同时在 docker 容器上安装 pip【英文标题】:EnvironmentError: HTTPSConnectionPool while pip install on docker container 【发布时间】:2020-04-03 11:03:58 【问题描述】:

我只是从https://github.com/puckel/docker-airflow 运行docker-compose,但由于我需要一个额外的python 包,我尝试在运行docker exec -it <containerId> bash 后手动安装它,但出现以下错误:

image

Defaulting to user installation because normal site-packages is not writeable
Collecting pymssql
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])"))': /packages/be/09/455835d22f84636dc646f4dc6afcc79c226d8bc253ef767ca8a922eec74a/pymssql-2.1.4-cp37-cp37m-manylinux1_x86_64.whl
  WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])"))': /packages/be/09/455835d22f84636dc646f4dc6afcc79c226d8bc253ef767ca8a922eec74a/pymssql-2.1.4-cp37-cp37m-manylinux1_x86_64.whl
  WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])"))': /packages/be/09/455835d22f84636dc646f4dc6afcc79c226d8bc253ef767ca8a922eec74a/pymssql-2.1.4-cp37-cp37m-manylinux1_x86_64.whl
  WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])"))': /packages/be/09/455835d22f84636dc646f4dc6afcc79c226d8bc253ef767ca8a922eec74a/pymssql-2.1.4-cp37-cp37m-manylinux1_x86_64.whl
  WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])"))': /packages/be/09/455835d22f84636dc646f4dc6afcc79c226d8bc253ef767ca8a922eec74a/pymssql-2.1.4-cp37-cp37m-manylinux1_x86_64.whl
ERROR: Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/be/09/455835d22f84636dc646f4dc6afcc79c226d8bc253ef767ca8a922eec74a/pymssql-2.1.4-cp37-cp37m-manylinux1_x86_64.whl (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])")))

在我能够毫无问题地运行pip install pymssql 之前的几天。不知道为什么现在会发生这种情况,没有对 docker-compose.yml 文件进行任何更改,也没有在网上进行更改

【问题讨论】:

【参考方案1】:

我在 2020 年 8 月 16 日遇到了同样的错误。注意到https://files.pythonhosted.org SSL 证书是在 8 月 13 日颁发的。然后我登录到容器并检查日期,日期是 8 月 12 日。这就是 SSL 验证失败的原因。如果您在 Windows 上,请重新启动 docker 桌面以与主机同步时间。但这会杀死你正在运行的容器。如果您不想杀死正在运行的容器,则必须手动更新 docker 容器内的时间。

【讨论】:

以上是关于EnvironmentError: HTTPSConnectionPool 同时在 docker 容器上安装 pip的主要内容,如果未能解决你的问题,请参考以下文章

raise EnvironmentError("%s not found" % (mysql_config.path,)) EnvironmentError: mysql_

EnvironmentError: HTTPSConnectionPool 同时在 docker 容器上安装 pip

由于 EnvironmentError 无法安装“discord.py”

[已解决]EnvironmentError: mysql_config not found

由于 EnvironmentError 无法安装软件包:[Errno 2] 没有这样的文件或目录 \\METADATA

由于 EnvironmentError 无法安装软件包:[WinError 5] 访问被拒绝: