0

I did the manual installation on python 3.7.5 on Debian 8, when I will run the script I get this error:

<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)>

I saw several questions here in the stackoverflow more regarding MacOS, In my case this error is in Linux.

Marcin Orlowski
  • 68,918
  • 10
  • 117
  • 136
JB_
  • 403
  • 1
  • 6
  • 16

3 Answers3

3

I had the same issue. Here is what I found helped my problem.

import ssl

ssl._create_default_https_context = ssl._create_unverified_context

Please see here for the original answer from markroxor. Hope it will help your problem as well.

JingMT
  • 41
  • 3
1

I had

<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)>

With python3 3.9.2-3, and other python related packages with the same, or similar, version. On Debian GNU/Linux 11 (Bullseye).

At first, using the suggested

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

managed to solve the problem. Though I do not know if, and which, down sides, or other side effects, this solution has.

Afterwards, I noticed the /etc/ssl/certs/ folder is empty. Installing the ca-certificates package fills in this folder. Which seem to be another solution, in which those 2 python ssl lines are not required. You can see here the detailed list of files the ca-certificates package installed. This article, from 2015, with a last comment from 2017, discusses the location of ca-certificates in various OSs/distributions. I think the ca-certificates package is rather basic, and is usually installed as part of the initial installation of the machine. I do not know how it was missing from that particular machine.

nh4c
  • 11
  • 3
0

THIS IS NOT A SOLUTION: I have encountered that several times, note however that i'm using windows, but i would assume that generally the resolving mehtods should be the same in principle for mac/linux.

What i used to do is to force it to not verify the certificate by using the below:

conda config --set ssl_verify false

Note this is not a solution to the issue, it's just a way to make the code run temporarily, or if you're trying to download a library then that should do the trick until you download it. Note that the suggested below is not usually recommended, if you do it, after running your code/ downloading your library, remember to turn it back on using the below:

conda config --set ssl_verify true
mIT
  • 48
  • 6