Resolve pip install connection error: ceritificate validate failed

Apr 22, 2022 · 1 min read · Post a comment

In one of my previous pip posts I wrote about how to Resolve pip install package_name error: Couldn’t find a version that satisfies the requirement, and today we are going to fix another common pip issue.

Getting page<package_name>/
Could not fetch URL<package_name>/: connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)
Will skip URL<package_name>/ when looking for download links for <package_name>
Getting page
Could not fetch URL connection error: HTTPSConnectionPool(host='', port=443): Max retries exceeded with url: /simple/ (Caused by <class 'http.client.CannotSendRequest'>: Request-sent)
Will skip URL when looking for download links for linkchecker
Cannot fetch index base URL


  • Python
  • pip


The cause is pretty straightforward. You might be sitting behind a firewall and/or proxy, hence your host machine doesn’t trust the Python certificates.

Possible solutions

Solution 1 (Temp). Add the --trusted-host flag when running pip install. For instance:

pip install <package_name> --trusted-host --trusted-host --trusted-host

Solution 2 (Permanent). Add the Python servers into the pip.conf file.

trusted-host =

pip.conf file location:

  • Linux: $HOME/.config/pip/pip.conf or /etc/pip.conf (Global)
  • macOS: $HOME/Library/Application Support/pip/pip.conf
  • Windows: %APPDATA%\pip\pip.ini


If you can think of any other alternative solution, please do let me know in the comment section below. On a side note, follow our official channel on Telegram.