# SSL: CERTIFICATE\_VERIFY\_FAILED ( Windows )

**URL:** <https://discuss.python.org/t/ssl-certificate-verify-failed-windows/39142>\
**Category:** Python Help\
**Created:** [November 19, 2023, 7:37pm UTC](https://discuss.python.org/t/ssl-certificate-verify-failed-windows/39142 "2023-11-19T19:37:55Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![SpongeB0B](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/spongeb0b/32/13257_2.png) [@SpongeB0B](https://discuss.python.org/u/SpongeB0B)\
**Post date:** [November 19, 2023, 7:37pm UTC](https://discuss.python.org/t/ssl-certificate-verify-failed-windows/39142/1 "2023-11-19T19:37:56Z")

</div>

Hi,

I’m using

```python
from smtplib import SMTP_SSL

```

under Linux and it work flawlessly.

But under Windows10 I get

> [SSL: CERTIFICATE\_VERIFY\_FAILED] certificate verify failed: unable to get local issuer certificate (\_ssl.c:1000)

> **Extract's of my code**
>
> ```python
> context = ssl.create_default_context()
> context.minimum_version = ssl.TLSVersion.TLSv1_3
> context.maximum_version = ssl.TLSVersion.TLSv1_3
> 
> with SMTP_SSL("SomeSMTPServer.com", port=465, context=context) as SMTPssl:
> .....
> 
> ```

I’ve dig a little bit around and I’ve seen this

```bash
pip install --upgrade certifi

```

[PyPi certifi](https://pypi.org/project/certifi/)

Seem great, but I don’t see how to initialize it in my project ?

Just `import certifi` seem not enough…

or when doing `pip install --upgrade certifi` is it modifying directly the Python CA store ?

Thanks.

---

<div class="post-metadata">

**Author:** ![csm10495](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/csm10495/32/9731_2.png) [@csm10495](https://discuss.python.org/u/csm10495)\
**Post date:** [November 19, 2023, 8:09pm UTC](https://discuss.python.org/t/ssl-certificate-verify-failed-windows/39142/2 "2023-11-19T20:09:26Z")

</div>

I think you do something like this:

```auto
context = ssl.create_default_context(cafile=certifi.where())

```

That will have the context use certifi’s pem file.

---

<div class="post-metadata">

**Author:** ![barry-scott](https://avatars.discourse-cdn.com/v4/letter/b/e9c0ed/32.png) [@barry-scott](https://discuss.python.org/u/barry-scott)\
**Post date:** [November 19, 2023, 10:39pm UTC](https://discuss.python.org/t/ssl-certificate-verify-failed-windows/39142/3 "2023-11-19T22:39:09Z")

</div>

Can’t python user the windows trust store?  
I recall reading about a pypi package that needed to be added to do that, but I do not recall the details.

---

<div class="post-metadata">

**Author:** ![SpongeB0B](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/spongeb0b/32/13257_2.png) [@SpongeB0B](https://discuss.python.org/u/SpongeB0B)\
**Post date:** [November 20, 2023, 5:18am UTC](https://discuss.python.org/t/ssl-certificate-verify-failed-windows/39142/4 "2023-11-20T05:18:07Z")

</div>

I’ve found [wincertstore](https://pypi.org/project/wincertstore/)  
but it’s weird because we can read on their PyPi page

> The package is deprecated. Since Python 2.7.9 ssl.create\_default\_context() automatically loads certificates from Windows’ cert store.

if it’s the case, I’m wondering why people under windows face this error…

---

<div class="post-metadata">

**Author:** ![SpongeB0B](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/spongeb0b/32/13257_2.png) [@SpongeB0B](https://discuss.python.org/u/SpongeB0B)\
**Post date:** [November 20, 2023, 6:31am UTC](https://discuss.python.org/t/ssl-certificate-verify-failed-windows/39142/5 "2023-11-20T06:31:00Z")

</div>

it’s working , thanks !

But of course this solution only work if the target server certificate is signed by one of those CA…

and of course it’s only a temporary solution as CA have a validity date… 😕

---

<div class="post-metadata">

**Author:** ![petersuter](https://avatars.discourse-cdn.com/v4/letter/p/13edae/32.png) [@petersuter](https://discuss.python.org/u/petersuter)\
**Post date:** [November 20, 2023, 7:15am UTC](https://discuss.python.org/t/ssl-certificate-verify-failed-windows/39142/6 "2023-11-20T07:15:35Z")

</div>

Maybe related to one of these issues?

- [Python doesn’t load intermediate certificates on Windows](https://github.com/python/cpython/issues/62817)
- [Python doesn’t trigger the download of the certificate bundle on Windows](https://github.com/python/cpython/issues/80192).

Do you know which certificate is missing? [A test tool like this](https://www.ssllabs.com/ssltest/) should show the entire required chain under “Additional Certificates (if supplied)”.

---

<div class="post-metadata">

**Author:** ![he.zong](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/he.zong/32/13801_2.png) [@he.zong](https://discuss.python.org/u/he.zong)\
**Post date:** [June 20, 2024, 11:11am UTC](https://discuss.python.org/t/ssl-certificate-verify-failed-windows/39142/7 "2024-06-20T11:11:27Z")

</div>

It seems like you encountered an SSL certificate verification error while making an HTTP request.

This error typically occurs when the SSL certificate of the server you’re trying to connect to can’t be verified using the trusted CA certificates on your system.

we need to Ensure the CA Bundle Path is Correct.

More info here : [5 Ways to fix SSL: CERTIFICATE\_VERIFY\_FAILED in Python - howtouselinux](https://www.howtouselinux.com/post/ssl-certificate_verify_failed-in-python)

---

<div class="post-metadata">

**Author:** ![rocky22](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/rocky22/32/24386_2.png) [@rocky22](https://discuss.python.org/u/rocky22)\
**Post date:** [December 5, 2024, 9:40pm UTC](https://discuss.python.org/t/ssl-certificate-verify-failed-windows/39142/8 "2024-12-05T21:40:14Z")

</div>

below helped for me after everything else I tried:

```python
pip install pip-system-certs

```

---

<div class="post-metadata">

**Author:** ![alejandroandreatta](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@alejandroandreatta](https://discuss.python.org/u/alejandroandreatta)\
**Post date:** [May 4, 2025, 6:44am UTC](https://discuss.python.org/t/ssl-certificate-verify-failed-windows/39142/11 "2025-05-04T06:44:15Z")

</div>

Thanks Rocky  
I’m behind a corporate firewall. After looking at 100’s of web pages with suggestions this command finally fixed the problem.

---

<div class="post-metadata">

**Author:** ![andmcg](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/andmcg/32/29039_2.png) [@andmcg](https://discuss.python.org/u/andmcg)\
**Post date:** [July 8, 2025, 10:43am UTC](https://discuss.python.org/t/ssl-certificate-verify-failed-windows/39142/12 "2025-07-08T10:43:35Z")

</div>

I signed up just to say “thank you”  
This is the fix that I needed to get some Home Assistant integrations working again after upgrading to Python 3.13 on Debian.

---

<div class="post-metadata">

**Author:** ![Musbi8788](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/musbi8788/32/32729_2.png) [@Musbi8788](https://discuss.python.org/u/Musbi8788)\
**Post date:** [November 24, 2025, 8:42pm UTC](https://discuss.python.org/t/ssl-certificate-verify-failed-windows/39142/13 "2025-11-24T20:42:33Z")

</div>

Thank you @rocky22
