Pip Install – SSL Error: Certificate_Verify_Failed

If you are trying to install some Python package using the pip install command and pip fails to verify the SSL certificate, you may receive the error as follows:

Could not fetch URL https://pypi.org/…/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=’pypi.org’, port=443): Max retries exceeded with url: /…/ (Caused by SSLError(SSLCertVerificationError(1, ‘[ SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: … – skipping

If there is a problem with confirming the SSL certificate of a repository, you can add it as a --trusted-host that will make pip ignore the SSL certificate check for this repository.

Cool Tip: How to install specific version of a package using pip! Read More →

Pip Install – Ignore SSL Certificate

Warning: Adding the repositories to the trusted sources disables SSL certificate verification and exposes a vulnerability to a man-in-the-middle attack.

To configure pip to ignore SSL certificate verification, add the required repositories to the trusted sources, for example:

$ pip install --trusted-host pypi.org \
              --trusted-host files.pythonhosted.org \

The trusted hosts can also be added to the config file:

# pip.ini (Windows)
# pip.conf (Unix, macOS)

trusted-host = pypi.org