PYTHON pip install fails with “connection error: [SSL: CERTIFICATE_VERIFY_FAILED]

If you manage the proxy or SSL certificate separately, the following certificate error may occur. In this case, you can use it by specifying a trusted host in Python’s package installation tool, pip.

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

How to fix this CERTIFICATE_VERIFY_FAILED

Command Line

Specify that the domain used by pip is trusted through –trusted-host on the command line.

pip --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org install <pakage>

Environment(config) file

The second way is through the environment(config) file used by pip.

[global]
trusted-host = pypi.python.org
               pypi.org
               files.pythonhosted.org

When you use Visual Studio or some IDE tool you need to add config file

%APPDATA%\pip\pip.ini (Windows)
%HOME/.config/pip.conf (unix)

If you don’t have pip folder, you have to make pip folder first before make config file.

https://pip.pypa.io/en/stable/user_guide/?highlight=appdata#config-file

Facebook Comments

Leave A Reply

Detection ADBlockPlease, Disable or add to white list on our site.