python-3.xpipopensslrhel8

Pip Install failure with error TLSV1_ALERT_PROTOCOL_VERSION in RHEL 8


I am getting error when installing packages using pip install on RHEL8 version

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:1076)'))': /simple/requests/

My python version is 3.7.6 and pip version is 19.2.3

From root user I have below openssl rpms installed

  1. openssl-libs-1.1.1k-6.el8_5.x86_64
  2. openssl-pkcs11-0.4.10-2.el8.x86_64
  3. openssl-devel-1.1.1k-6.el8_5.x86_64
  4. xmlsec1-openssl-1.2.25-4.el8.x86_64 openssl-1.1.1k-6.el8_5.x86_64

I tried using below commands but getting the same error

pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org requests

curl https://bootstrap.pypa.io/get-pip.py | python

Can some one please help on how to fix this .

Thanks,


Solution

  • I solved it by changing the setting crypto policies to LEGACY:

    # (run from root) 
    update-crypto-policies --set LEGACY