pip install fails with "connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)"

Cover Image for pip install fails with "connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)"
Matheus Mello
Matheus Mello
published a few days ago. updated a few hours ago

Installing Python Packages with Pip: Fixing SSL Certificate Verify Failed Error

If you're new to Python and facing issues with installing packages using pip on Windows 7, chances are you might encounter the dreaded "connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)" error. Don't worry, this guide will walk you through common scenarios and provide easy solutions to fix this problem. 💻🔧

Understanding the Problem

The SSL certificate verification failed error occurs when pip is unable to verify the SSL certificate of the source URL it's trying to access. This typically happens due to various reasons, such as:

  • Outdated version of pip

  • Antivirus or firewall blocking the SSL certificate verification

  • Network proxy issues

  • Missing SSL certificates on your system

It's important to understand that this error can occur not only when installing a specific package (like linkchecker in this case) but also when installing any package using pip.

Troubleshooting Steps and Solutions

To fix the SSL certificate verify failed error, follow these simple steps:

1. Update pip

Using an outdated version of pip can cause compatibility issues and SSL certificate verification failures. To update pip, open a command prompt and run the following command:

pip install --upgrade pip

This command will fetch and install the latest version of pip.

2. Configure Trusted Root Certificate Authority

If your company network has a Trusted Root Certificate Authority in place (such as for monitoring TLS traffic), it's possible that it's interfering with pip's SSL certificate verification. To address this issue, you can try configuring pip to trust the root certificate authority used by your company.

Run the following command to download the root certificate authority:

pip config set global.cert "/path/to/your/root_certificate.crt"

Make sure to replace /path/to/your/root_certificate.crt with the path to the root certificate authority file on your system.

3. Disable SSL Verification (Not Recommended)

As a last resort, you can temporarily disable SSL certificate verification. However, this is not recommended as it poses security risks. Only consider this option if you're confident in the source you're installing packages from.

To disable SSL verification, run the following command:

pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org packagename

Replace packagename with the name of the package you're trying to install.

4. Check Firewall and Antivirus Settings

Firewalls and antivirus software sometimes block connections and SSL certificate verification. Temporarily disabling them or adding exceptions for pip in your firewall and antivirus settings can help resolve the issue.

5. Check Network Proxy Settings

If you're behind a network proxy, it's possible that the proxy is causing the SSL certificate verification failure. Contact your network administrator or IT support to ensure that the proxy settings are configured correctly for pip.

Wrapping Up

By following these troubleshooting steps, you should be able to resolve the "connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)" issue when using pip to install Python packages. Remember to keep your pip version up-to-date, configure trusted root certificate authorities if necessary, and check your firewall, antivirus, and network proxy settings.

If you found this guide helpful, have experienced a different issue, or have any questions, feel free to share your thoughts in the comments below. Happy coding! 🐍💻


More Stories

Cover Image for How can I echo a newline in a batch file?

How can I echo a newline in a batch file?

updated a few hours ago
batch-filenewlinewindows

🔥 💻 🆒 Title: "Getting a Fresh Start: How to Echo a Newline in a Batch File" Introduction: Hey there, tech enthusiasts! Have you ever found yourself in a sticky situation with your batch file output? We've got your back! In this exciting blog post, we

Matheus Mello
Matheus Mello
Cover Image for How do I run Redis on Windows?

How do I run Redis on Windows?

updated a few hours ago
rediswindows

# Running Redis on Windows: Easy Solutions for Redis Enthusiasts! 🚀 Redis is a powerful and popular in-memory data structure store that offers blazing-fast performance and versatility. However, if you're a Windows user, you might have stumbled upon the c

Matheus Mello
Matheus Mello
Cover Image for Best way to strip punctuation from a string

Best way to strip punctuation from a string

updated a few hours ago
punctuationpythonstring

# The Art of Stripping Punctuation: Simplifying Your Strings 💥✂️ Are you tired of dealing with pesky punctuation marks that cause chaos in your strings? Have no fear, for we have a solution that will strip those buggers away and leave your texts clean an

Matheus Mello
Matheus Mello
Cover Image for Purge or recreate a Ruby on Rails database

Purge or recreate a Ruby on Rails database

updated a few hours ago
rakeruby-on-railsruby-on-rails-3

# Purge or Recreate a Ruby on Rails Database: A Simple Guide 🚀 So, you have a Ruby on Rails database that's full of data, and you're now considering deleting everything and starting from scratch. Should you purge the database or recreate it? 🤔 Well, my

Matheus Mello
Matheus Mello