윈도우즈에서 종종 발생하는 PIP SSL ERROR를 고쳐보자
Anaconda/PIP를 사용해서 가상환경을 생성하거나 패키지를 설치하려고 할 때 주로 발생하는데, 아래와 같은 메시지가 뜨는 경우다.
Collecting package metadata (current_repodata.json): failed
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/win-64/current_repodata.json>
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
If your current network has https://www.anaconda.com blocked, please file a support request with your network engineering team.
SSLError(MaxRetryError('HTTPSConnectionPool(host=\'repo.anaconda.com\', port=443): Max retries exceeded with url: /pkgs/main/win-64/current_repodata.json (Caused by SSLError("Can\'t connect to HTTPS URL because the SSL module is not available."))'))
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: self signed certificate in certificate chain (_ssl.c:1051)'))': /packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None))
... 계속
C:\Users\%USERNAME%\Anaconda3\Library\bin
경로 열기
다음 네 가지 파일들을 복사
libcrypto-1_1-x64.dll
libcrypto-1_1-x64.pdb
libssl-1_1-x64.dll
libssl-1_1-x64.pdb
C:\Users\%USERNAME%\Anaconda3\Library\DLLs
경로에 붙여넣기
brew install openssl
apt-get install libssl-dev libffi-dev
yum install openssl-devel libffi-devel
cmd(혹은 Powershell)에 다음 커맨드를 입력해서 설치한다
conda install openssl
conda config --set ssl_verify false
pip로 패키지 설치 시 다음과 같은 명령어들을 붙여서 설치해본다
<pakcage>
에는 설치할 패키지의 이름을 넣으면 된다
pip install <package> --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org
매 번 위의 커맨드를 쳐야하는 상황이라면 아래와 같이 alias를 등록하자
alias pip='pip --trusted-host pypi.org --trusted-host files.pythonhosted.org'