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

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.

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.

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.

What worked for my MacOs:
Open the finder
Find the version of Python that you are using
Open its folder
Click on the "Install Certificates.command". It will open a terminal and install the certificate.

In my case (Dell computer), the SSL problem was caused by Dell software itself:
reported here. In that case, according to this answer to another question in the SE network, you can solve the problem by running the following command:
sudo cp /usr/lib/x86_64-linux-gnu/libcrypto.so.3 /opt/dell/dcc/libcrypto.so.3
And then, run this:
sudo update-ca-certificates --fresh
It worked for me on a Dell Latitude 7310, LinuxMint21. November 2022.

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

If this happened after you installed a python version manually, inside the python app folder, double click on the "Install Certificates.command" file and it should fix it.

Related

floobits Sublime Text 3 - SSL CERTIFICATE_VERIFY_FAILED unable to get local issuer certificate (_ssl.c:1124)

Edit 1: I am using the floobits plugin (latest release), uninstalled and installed again from the package manager. I am not getting a traceback but an error window with the following error message: Unable to join workspace. CERTIFICATE_VERIFY_FAILED unable to get local issuer certificate (_ssl.c:1124).
Edit 2: I had tried the Package Control Upgrade package and Staisfy Dependencies, but that did not help fix it.
I was able to fix it (answer below).
I have been stuck on this issue for days now. When I try to connect to a floobits workspace in sublime text, I get the error message that CERTIFICATE_VERIFY_FAILED unable to get local issuer certificate (_ssl.c:1124).
I searched about this a lot but I don't know what's wrong anymore.
I started by upgrading certifi and pip itself.
Then I read somewhere that I should check if OpenSSl(and the requests library of py) and cURL can open the URL (floobits.com) since the workspace is hosted there. curl returned no errors but OpenSSL (and requests) wasn't able to verify, gave the same error.
So I downloaded the certificates from the website on opening it in chrome. I downloaded all three certificates (for the root, intermediate and the website itself), and appended them to cacert.pem inside the certifi package folder. After that, when I ran it, OpenSSL was able to open it (and the requests library too, got a 200 response code).
But, floobits still wasn't able to connect and gave the same error. I know that there is nothing wrong with floobits.com and the sublime extension since a friend can still open the workspace without problems.
Please tell me what I can do to fix this.
So I managed to 'solve' the problem by bringing Sublime back to a fresh state and then copying my files again. Answering here if anyone gets this problem.
Method:
Go to the Sublime > Preferences > Browse Packages
In this folder, copy and backup the 'User' folder to someplace else.
Delete all the folders in this location (Sublime need not be closed during this but it's best if you do close it)
Copy the backed-up 'User' folder back here (remember the location where you deleted, %AppData%\Roaming\Sublime Text 3\Packages (for Windows))
All set, you now have a fresh installation of sublime.
Sublime will start installing all packages again, wait for it to finish and resume work.
This solved the problem I was having. Unfortunately, I couldn't track down the problem.

ClipGrab - Error downloading youtube-dl: SSL handshake failed

I have downloaded YouTube videos using ClipGrab before (v3.8.11), but after updating it (to v3.9.6) I get an error.
First I am informed that an additional dependency "youtube-dl" must be downloaded.
But when I try to do this I get: Error downloading youtube-dl: SSL handshake failed
I tried installing youtube-dl separately using brew install youtube-dl and it appears to have succeeded, but ClipGrab doesn't see this installation, and still gives the SSL error.
I tried going back to my old version of ClipGrab (v3.8.11) but it now gives a different error: Could not retrieve video link. So maybe there is some server issue or other problem not local to the app, that is preventing the old version from working too.
(1) Is there a way to get around the SSL error or make ClipGrab recognize my brew installation of youtube-dl? (2) If there is no way to get the current v3.9.6 working, is there a way to get an older version working?
Thanks
Hopefully this will work for you (it worked for me). I'm on Kubuntu 22.04, I had to manually download yt-dlp:
mkdir -p ~/.local/share/ClipGrab/ClipGrab
wget -P ~/.local/share/ClipGrab/ClipGrab/ \
https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp
After that clipgrab started working
Not sure about Mac using homebrew but with Linux this was my solution.
Running kubuntu 22.04 Same SSL handshake error
Here is the fix that worked for me..
Download the yt-dlp file from:
https://github.com/yt-dlp/yt-dlp#release-files
The yt-dlp file found on that page it is the first file in the recommended listing column.
On your computer:
Allow your file manager to show invisible directories/files. Or navigate with the terminal.
Navigate to home/user/.local/share/ClipGrab/ClipGrab/yt-dlp
Overwrite the existing file which will be there but empty, with the file you downloaded from the above link.
Open ClipGrab and the SSL error will be gone and the app will function.

Prolog pack_install SSL Error to swi-prolog.org

I'm not sure if this is the right place to ask this question:
I am trying to run a prolog file, that uses the prolog-library delay. So it has at some place in the beginning the following line:
:- use_module(library(delay)).
When starting that file, Prolog tells me
source_link `library(delay)` does not exist
Goal (directive) failed: atoms:use_module(library(delay))
So I thought, maybe I need to install that library manually, first. So I ran ?- pack_install(delay)
But that returned
% Contacting server at http://www.swi-prolog.org/pack/query ...
ERROR: SSL(14090086) ssl3_get_server_certificate: certificate verify failed
I have no idea how to proceed and google is not helping...
This is a problem connecting to the server offering the package.
It actually works for me:
% Contacting server at https://www.swi-prolog.org/pack/query ... ok
Install delay#0.3.3 from http://storage.googleapis.com/packs.ndrix.com/delay/delay-0.3.3.zip Y/n?
What is your Prolog version?
Can you download the pack directly. Either using the browser or wget/curl:
wget http://storage.googleapis.com/packs.ndrix.com/delay/delay-0.3.3.zip
The above is a zipfile of the repository https://github.com/mndrix/delay/
I suppose you can just put file delay/prolog/delay.pl onto the Prolog library search path.

SSL Error while installing any package from conda prompt

I use Anaconda Navigator for my machine learning experiments. Recently, I have started getting this strange SSL error no matter what I try to install using conda prompt. The error is SSL error. I am posting the error message that I get
Solving environment: failed
CondaHTTPError: HTTP 000 CONNECTION FAILED for url
https://repo.anaconda.com/pkgs/free/linux-64/repodata.json.bz2
Elapsed: -
An HTTP error occurred when trying to retrieve this URL. HTTP errors
are often intermittent, and a simple retry will get you on your way.
If your current network has https://www.anaconda.com blocked, please
file a support request with your network engineering team.
SSLError(MaxRetryError('HTTPSConnectionPool(host=\'repo.anaconda.com\',
port=443): Max retries exceeded with url:
/pkgs/free/linux-64/repodata.json.bz2 (Caused by
SSLError(SSLError("bad handshake: Error([(\'SSL routines\',
\'ssl3_get_server_certificate\', \'certificate verify
failed\')],)",),))',),)
I have an institutional proxy server; the credentials, apt.conf file etc are all OK.
Even then I am not able to install any package using conda.
Interestingly, I have installed numerous packages using conda prompt and I never faced any such error until recently. Also, I am able to follow the links (using the browser) given in the error message which means that the proxy is not blocking the site.
I was asked to use
conda config --set ssl_verify True
but even this did not help. Any help ?
I even entered the proxy server details as given in HTTP error while using conda for installation of any packages
Try copying these files from Anaconda3/Library/bin to Anaconda3/DLLs :
libcrypto-1_1-x64.dll
libssl-1_1-x64.dll
When I had an SSL error related to conda on my work laptop behind a firewall, I had to set ssl_verify to false to get it to work.
This should do the job.
conda config --set ssl_verify False
This is due to .dll error
go to location where you've install anaconda3>Library>bin. search and copy following dll files
libcrypto-1_1-x64.dll
libssl-1_1-x64.dll
and paste to anaconda3>DLLs.
then restart your pc.
issue will get resolved.
The following steps worked for me:
Use this command to see proxy_servers
conda config --show
This will remove saved proxy servers from anaconda configuration.
conda config --remove-key proxy_servers
conda clean --source-cache
Hope this helps you.

Unable to solve this error: error:14077458:SSL routines:SSL23_GET_SERVER_HELLO:reason(1112) -- any ideas on what to try?

This error arose while I was trying to deploy to aws. It turns out this is an issue on my machine that others are no experiencing.
jkazil#jlk:~/Projects/code/geoq-chef-repo [git master] $ vagrant up --provider=aws
Bringing machine 'default' up with 'aws' provider...
[default] Box 'ubuntu_aws' was not found. Fetching box from specified URL for
the provider 'aws'. Note that if the URL does not have
a box for this provider, you should interrupt Vagrant now and add
the box yourself. Otherwise Vagrant will attempt to download the
full box prior to discovering this error.
Downloading or copying the box...
An error occurred while executing multiple actions in parallel.
Any errors that occurred are shown below.
An error occurred while executing the action on the 'default'
machine. Please handle this error then try again:
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
error:14077458:SSL routines:SSL23_GET_SERVER_HELLO:reason(1112)
jlk:~/Projects/code/geoq-chef-repo [git master] $
I found a couple of things on the internets that said I should look at my version of openssl. At first, it was 0.9.8, but I had 1.0.1f in homebrew. So I found this: Update OpenSSL on OS X with Homebrew and followed it. And I was was able to update OpenSSL.
jkazil#jlk:~/Projects/code/geoq-chef-repo [git master] $ openssl version
OpenSSL 1.0.1f 6 Jan 2014
jlk:~/Projects/code/geoq-chef-repo [git master] $
But that didn't fix the issue. Just to clarify, this is not an aws issue, but an me issue. Here is me trying to pull a machine down locally. I am using the insecure flag to try to push it through, but it didn't work with or without.
jkazil#jlk:~/Projects/code/geoq-chef-repo [git master] $ vagrant box add dummy https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box --insecure
Downloading or copying the box...
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
error:14077458:SSL routines:SSL23_GET_SERVER_HELLO:reason(1112)
jlk:~/Projects/code/geoq-chef-repo [git master] $
Lastly, I wanted to share my PATH, just in case someone had that question.
jlk:~/Projects/code/geoq-chef-repo [git master] $ echo $PATH
/usr/local/Cellar/ruby/2.0.0-p247/bin:/Users/jkazil/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
jlk:~/Projects/code/geoq-chef-repo [git master] $
Any suggestions?
This is going to be sad answer, but the resolution to this was to update to 10.9. Then the problem went away. I know that this is not the answer that people want to here, but I thought I would try after banging my head against the wall for awhile.
Thank you everyone for your help!
P.S. VAGRANT_LOG=info was help also in getting set up.
I found a couple of things on the internets that said I should look at my version
of openssl. At first, it was 0.9.8, but I had 1.0.1f in homebrew. So I found this:
OpenSSL Version MacOSX Homebrew and followed it. And I was was able to update OpenSSL.
Mac OS X will do as much as it can to load 0.9.8 in /usr/lib:
$ find /usr/ -iname libssl*
/usr//lib/libssl.0.9.7.dylib
/usr//lib/libssl.0.9.8.dylib
/usr//lib/libssl.dylib
You will need to ensure you are loading the expected version of OpenSSL. If you can get it under gdb, issue info shared and see what version of OpenSSL actually loaded.
A few things about OS X and its linker: (1) it ignores rpath's; (2) it ignores requests like -Bstatic; (3) more generally, it always links to the shared object if available (even on iOS where the only thing you are suppose to use is an archive); (4) LD_PRELOAD is not honored.
You might have some luck with using DYLD_LIBRARY_PATH.
If you can't get OS X to use 1.0.1f, then you will have to re-build the components in question. But instead of specifying -L/usr/local/ssl -lssl -lcrypto, you will need to omit the flags and specify the full archive like /usr/local/ssl/lib/libssl.a (without the -l).
Don't buy into the claims you don't have to do these things on OS X (claims like "use -L and -lssl because that's what your suppose to use"). I suffered them for years on Apple's gear, and I know for certain it does not work (and the people making the claims apparently don't use OS X). OS X is a real bastard at times.
One cause for this error could be an old version of OpenSSL trying to connect to a server which uses HTTPS with SNI:
http://sourceforge.net/p/curl/bugs/1037/?limit=10&page=1#aa7f
Try setting the log level higher (e.g. VAGRANT_LOG=debug vagrant up – see the Vagrant debugging guide) to see the URL in question and test it by hand using curl to confirm the failure.