Skip to content

Python 에서 pip install 시 SSLCertVerificationError 발생하는 경우 #175

@occidere

Description

@occidere

상황

  • local PC 는 Zscaler 로 VPN 을 통해 네트워크 연결이 되어 있음

  • local 에서 pip install 을 통해 패키지를 설치하려고 하면 아래와 같이 SSLCertVerificationError 가 발생

    Details
     $ pip3 install beautifulsoup4
    
     zsh: /usr/local/Homebrew/bin/pip3: bad interpreter: /usr/local/Homebrew/opt/python@3.9/bin/python3.9: no such file or directory
     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:992)'))': /simple/beautifulsoup4/
     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:992)'))': /simple/beautifulsoup4/
     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:992)'))': /simple/beautifulsoup4/
     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:992)'))': /simple/beautifulsoup4/
     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:992)'))': /simple/beautifulsoup4/
     Could not fetch URL https://pypi.org/simple/beautifulsoup4/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/beautifulsoup4/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)'))) - skipping
     ERROR: Could not find a version that satisfies the requirement beautifulsoup4 (from versions: none)
     ERROR: No matching distribution found for beautifulsoup4
    

원인

  • Zscaler 쪽에서 파이썬 패키지 저장소 중 하나인 pypi.python.org 로의 연결이 제한됨

해결

  • 하지만 2018년 이후 pypi.org 를 대신 사용중이기 때문에 굳이 pypi.python.org 로 접근할 필요가 없으므로 아래와 같이 커맨드를 입력하여 우회하면 됨
    pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org {설치할 패키지 이름}
  • 영구적인 해결 방법은 참고 링크 확인

참고

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions