0
votes

Hi i am having issue while building python image

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.

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)')))

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.

I tried, uninstalling all python interpreter and reinstalling but same result.

We are not using proxy server and i can ping files.pythonhosted.org properly

Hope you someone can help me on this. Thank you.

1

1 Answers

0
votes

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')