Skip to content

Q&A · Answered

pip install failing with SSL certificate error

asked 9 months, 1 week ago 1007 views 1 answer
9

When I try pip install, I get SSL: CERTIFICATE_VERIFY_FAILED error. How can I fix this?

1 Answer

One accepted
18

Accepted answer

Not confirmed since it was written, 9 months, 1 week ago

SSL certificate errors can occur due to corporate proxies or outdated certificates. Here are the solutions:

Update pip and certificates

# Update pip
python -m pip install --upgrade pip
# Install/update certificates
pip install --upgrade certifi

Use trusted host (temporary fix)

pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org package-name

Set in pip.conf (permanent fix)

# Create/edit ~/.pip/pip.conf
[global]
trusted-host = pypi.org
               pypi.python.org
               files.pythonhosted.org

Your answer

Say what you tried, not only what worked — the next person needs the reasoning. Code goes in a fenced block.

Shown beside your answer and never checked, so it cannot be a name someone already has here.

No account needed to answer. Sign in instead and it carries your name and earns reputation.