Software⏱️ 3 min read📅 2026-06-11

How to Fix: pip cannot fetch URL because of an error with the SSL certificate

pip cannot fetch URL because of an error with the SSL certificate

Quick Answer: Try using the --trusted-host option with a specific host, or consider disabling SSL verification for all hosts.

The error 'pip cannot fetch URL because of an error with the SSL certificate' affects users trying to install Python packages using pip. This issue is frustrating as it prevents users from installing new modules, and the cause seems to be related to the SSL certificate. However, this problem can be solved by following a specific troubleshooting guide.

The primary goal of this guide is to help users resolve the 'pip cannot fetch URL' error caused by an SSL certificate issue. By going through the steps outlined in this guide, users should be able to identify and fix the root cause of the problem.

⚠️ Common Causes

  • The most common reason for this error is a mismatch between the SSL version used by pip and the one expected by the package index. This can happen due to changes in the default SSL version used by Python or the package index itself.
  • Another possible cause could be an issue with the SSL certificate of the package index, which may not be trusted by the system's SSL configuration.

✅ Best Solutions to Fix It

Update pip and verify the SSL version

  1. Step 1: Open a terminal or command prompt as the administrator and run the following commands to update pip: `sudo apt-get update && sudo apt-get install -y python3-pip` (for Debian-based systems) or `brew upgrade` (for macOS).
  2. Step 2: Verify that the default SSL version used by pip is compatible with the package index. You can do this by running `pip show ssl` and checking if the 'default' value matches the expected SSL version.
  3. Step 3: Run `pip install fastnumbers --upgrade-dep` to force an upgrade of the package, which may help resolve any issues related to the SSL certificate.

Disable SSL verification for the package index

  1. Step 1: Use the `--trusted-host` option with pip to disable SSL verification for a specific host. For example: `pip install --trusted-host pypi.org fastnumbers`. Repeat this process for other hosts that may be causing issues.
  2. Step 2: Alternatively, you can add the following line to your `~/.pip/pip.conf` file to disable SSL verification for all hosts: `[target: https://pypi.python.org]`.

💡 Conclusion

To resolve the 'pip cannot fetch URL' error caused by an SSL certificate issue, try updating pip and verifying the SSL version used. If this doesn't work, you can disable SSL verification for specific hosts or add a configuration to disable it globally.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions