본문 바로가기
Python

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

by 올엠 2020. 10. 6.
반응형

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

 

User Guide — pip 20.2.3 documentation

pip 20.1 included an alpha version of the new resolver (hidden behind an optional --unstable-feature=resolver flag). pip 20.2 removes that flag, and includes a robust beta of the new resolver (hidden behind an optional --use-feature=2020-resolver flag) tha

pip.pypa.io

 

댓글0