Esp-idf: SSL: CERTIFICATE_VERIFY_FAILED (IDFGH-1876)

Created on 17 Sep 2019  路  18Comments  路  Source: espressif/esp-idf

Hello I have tried to use the guideline for installing the esp-idf. I receive the following error when trying to run the install.sh command. The following error is given:

Lions-MacBook:esp-idf LionMacBook$ ./install.sh
Installing ESP-IDF tools
Installing tools: xtensa-esp32-elf, esp32ulp-elf, openocd-esp32
Installing [email protected]
Downloading xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-macos.tar.gz to /Users/LionMacBook/.espressif/dist/xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-macos.tar.gz.tmp
Traceback (most recent call last):
File "/Users/LionMacBook/esp/esp-idf/tools/idf_tools.py", line 1317, in
main(sys.argv[1:])
File "/Users/LionMacBook/esp/esp-idf/tools/idf_tools.py", line 1313, in main
action_func(args)
File "/Users/LionMacBook/esp/esp-idf/tools/idf_tools.py", line 1107, in action_install
tool_obj.download(tool_version)
File "/Users/LionMacBook/esp/esp-idf/tools/idf_tools.py", line 541, in download
urlretrieve(url, local_temp_path, report_progress if not global_non_interactive else None)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 98, in urlretrieve
return opener.retrieve(url, filename, reporthook, data)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 245, in retrieve
fp = self.open(url, data)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 213, in open
return getattr(self, name)(url)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 443, in open_https
h.endheaders(data)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1038, in endheaders
self._send_output(message_body)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 882, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 844, in send
self.connect()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1263, in connect
server_hostname=server_hostname)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 369, in wrap_socket
_context=self)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 599, in __init__
self.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 828, in do_handshake
self._sslobj.do_handshake()
IOError: [Errno socket error] [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)

I have tried multiple versions(latest stable and Beta). I have tried to reinstall Python2.7 and made sure it is the only version in the PATH variable. Removed it and tried again a few times. I also double checked that all dependencies where installed correctly. Any ideas why this would be?

Most helpful comment

This issue is still not solved. I am facing this issue from last 2 days.
Please fix it.
thank you.

All 18 comments

@LCSimba Thanks for reporting, we will look into. Thanks.

I have the same problem described by @LCSimba . When I run install.sh in Mac OS

Same for the Windows. looks like Certificate expired.

@juliendland that worked.

@projectgus @igrr @renzbagaporo looks like the SSL cert on the https://dl.espressif.com/ website has expired - could you please update the certs otherwise setup would be broken for everyone. The above is just a temporary workaround. I am surprised it's been expired for over 7 days already.

As @juliendland mentioned, if you want to disable the SSL check temporarily, just update the tools/idf_tools.py file from esp-idf folder and add these lines in the import section

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

@SaurabhBajaj We have fixed the certificate, would you please help try again? Thanks.

Hello I have downloaded the idf again and following the steps. It is still giving the same error:

Lions-MacBook:esp-idf LionMacBook$ ./install.sh
Installing ESP-IDF tools
Installing tools: xtensa-esp32-elf, esp32ulp-elf, openocd-esp32
Installing [email protected]
Downloading xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-macos.tar.gz to /Users/LionMacBook/.espressif/dist/xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-macos.tar.gz.tmp
Traceback (most recent call last):
File "/Users/LionMacBook/esp/esp-idf/tools/idf_tools.py", line 1317, in
main(sys.argv[1:])
File "/Users/LionMacBook/esp/esp-idf/tools/idf_tools.py", line 1313, in main
action_func(args)
File "/Users/LionMacBook/esp/esp-idf/tools/idf_tools.py", line 1107, in action_install
tool_obj.download(tool_version)
File "/Users/LionMacBook/esp/esp-idf/tools/idf_tools.py", line 541, in download
urlretrieve(url, local_temp_path, report_progress if not global_non_interactive else None)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 98, in urlretrieve
return opener.retrieve(url, filename, reporthook, data)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 245, in retrieve
fp = self.open(url, data)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 213, in open
return getattr(self, name)(url)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 443, in open_https
h.endheaders(data)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1038, in endheaders
self._send_output(message_body)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 882, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 844, in send
self.connect()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1263, in connect
server_hostname=server_hostname)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 369, in wrap_socket
_context=self)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 599, in __init__
self.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 828, in do_handshake
self._sslobj.do_handshake()
IOError: [Errno socket error] [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)

The issue is still there
@SaurabhBajaj fixed it for me, thanks!

The expired cert should be fixed now, and should auto-renew correctly from now on. Thanks everyone for your patience while we resolved this issue.

This issue is still not solved. I am facing this issue from last 2 days.
Please fix it.
thank you.

https://stackoverflow.com/a/41692664/1812235 this is what it helped me! We need to run "Install Certificates.command" from /Applications/Python 3.6/. This is applicable even for Python 2.6 as well.

/Applications/Python 3.6/Install Certificates.command

Today(26-Aug-2020), I encountered the same problem while installing ESP-IDF.

Installing ESP-IDF tools
Installing tools: xtensa-esp32-elf, xtensa-esp32s2-elf, esp32ulp-elf, esp32s2ulp-elf, cmake, openocd-esp32, ninja, idf-exe, ccache
Installing [email protected]
Downloading xtensa-esp32-elf-gcc8_2_0-esp-2019r2-win32.zip to C:\Users\hp-pavilion\.espressif\dist\xtensa-esp32-elf-gcc8_2_0-esp-2019r2-win32.zip.tmp
WARNING: Download failure <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)>
WARNING: Failed to download https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_2_0-esp-2019r2-win32.zip to C:\Users\hp-pavilion\.espressif\dist\xtensa-esp32-elf-gcc8_2_0-esp-2019r2-win32.zip.tmp
Downloading xtensa-esp32-elf-gcc8_2_0-esp-2019r2-win32.zip to C:\Users\hp-pavilion\.espressif\dist\xtensa-esp32-elf-gcc8_2_0-esp-2019r2-win32.zip.tmp
WARNING: Download failure <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)>
WARNING: Failed to download https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_2_0-esp-2019r2-win32.zip to C:\Users\hp-pavilion\.espressif\dist\xtensa-esp32-elf-gcc8_2_0-esp-2019r2-win32.zip.tmp
Downloading xtensa-esp32-elf-gcc8_2_0-esp-2019r2-win32.zip to C:\Users\hp-pavilion\.espressif\dist\xtensa-esp32-elf-gcc8_2_0-esp-2019r2-win32.zip.tmp
WARNING: Download failure <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)>
WARNING: Failed to download https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_2_0-esp-2019r2-win32.zip to C:\Users\hp-pavilion\.espressif\dist\xtensa-esp32-elf-gcc8_2_0-esp-2019r2-win32.zip.tmp
ERROR: Failed to download, and retry count has expired
Traceback (most recent call last):
  File "D:\workspace\emmate-release\emmate-v2.1-esp32\sdk\esp-idf\tools\idf_tools.py", line 1492, in <module>
    main(sys.argv[1:])
  File "D:\workspace\emmate-release\emmate-v2.1-esp32\sdk\esp-idf\tools\idf_tools.py", line 1488, in main
    action_func(args)
  File "D:\workspace\emmate-release\emmate-v2.1-esp32\sdk\esp-idf\tools\idf_tools.py", line 1181, in action_install
    tool_obj.download(tool_version)
  File "D:\workspace\emmate-release\emmate-v2.1-esp32\sdk\esp-idf\tools\idf_tools.py", line 598, in download
    raise DownloadError()
__main__.DownloadError

Hi @noyelseth,

The certificate on dl.espressif.com is up to date (expiry 19 November 2020) and showing as valid.

It looks like you're using Windows, is that right? Is it a new-ish Windows install?

There is a known issue with Python and Windows where the certificate store doesn't add certificates initially, it adds them on the fly. But Python doesn't do this.

You can try the following things to resolve:

Hey @projectgus,

Thanks. It worked.

Hi.. guys
I'm facing the Same issue with the Linux 18.04 LTS
here are the logs

Installing ESP-IDF tools
Installing tools: xtensa-esp32-elf, xtensa-esp32s2-elf, xtensa-esp32s3-elf, esp32ulp-elf, esp32s2ulp-elf, openocd-esp32
Installing [email protected]
Downloading xtensa-esp32-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz to /home/dnk127/.espressif/dist/xtensa-esp32-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz.tmp
WARNING: Download failure WARNING: Failed to download https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz to /home/dnk127/.espressif/dist/xtensa-esp32-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz.tmp
Downloading xtensa-esp32-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz to /home/dnk127/.espressif/dist/xtensa-esp32-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz.tmp
WARNING: Download failure WARNING: Failed to download https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz to /home/dnk127/.espressif/dist/xtensa-esp32-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz.tmp
Downloading xtensa-esp32-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz to /home/dnk127/.espressif/dist/xtensa-esp32-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz.tmp
WARNING: Download failure WARNING: Failed to download https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz to /home/dnk127/.espressif/dist/xtensa-esp32-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz.tmp
ERROR: Failed to download, and retry count has expired
Traceback (most recent call last):
File "/home/dnk127/esp/esp-idf/tools/idf_tools.py", line 1591, in
main(sys.argv[1:])
File "/home/dnk127/esp/esp-idf/tools/idf_tools.py", line 1587, in main
action_func(args)
File "/home/dnk127/esp/esp-idf/tools/idf_tools.py", line 1280, in action_install
tool_obj.download(tool_version)
File "/home/dnk127/esp/esp-idf/tools/idf_tools.py", line 697, in download
raise DownloadError()
__main__.DownloadError

Can any one help me here ?
Thanks

Looks like it's back (with macOS) as well.... As an aside what I can't understand is how issues are closed when following the directions simply doesn't work on a fresh machine. It implies there's no testing and reflects poorly on the company.

Note adding the following in idf_tools.py :

ssl._create_default_https_context = ssl._create_unverified_context

let it get further... but still get the following after a while:

WARNING: Download failure WARNING: Failed to download https://dl.espressif.com/dl/xtensa-esp32s3-elf-gcc8_4_0-esp-2020r3-macos.tar.gz to /Users/abdul/.espressif/dist/xtensa-esp32s3-elf-gcc8_4_0-esp-2020r3-macos.tar.gz.tmp
Downloading xtensa-esp32s3-elf-gcc8_4_0-esp-2020r3-macos.tar.gz to /Users/abdul/.espressif/dist/xtensa-esp32s3-elf-gcc8_4_0-esp-2020r3-macos.tar.gz.tmp
WARNING: Download failure WARNING: Failed to download https://dl.espressif.com/dl/xtensa-esp32s3-elf-gcc8_4_0-esp-2020r3-macos.tar.gz to /Users/abdul/.espressif/dist/xtensa-esp32s3-elf-gcc8_4_0-esp-2020r3-macos.tar.gz.tmp
Downloading xtensa-esp32s3-elf-gcc8_4_0-esp-2020r3-macos.tar.gz to /Users/abdul/.espressif/dist/xtensa-esp32s3-elf-gcc8_4_0-esp-2020r3-macos.tar.gz.tmp
WARNING: Download failure WARNING: Failed to download https://dl.espressif.com/dl/xtensa-esp32s3-elf-gcc8_4_0-esp-2020r3-macos.tar.gz to /Users/abdul/.espressif/dist/xtensa-esp32s3-elf-gcc8_4_0-esp-2020r3-macos.tar.gz.tmp
ERROR: Failed to download, and retry count has expired

Was this page helpful?
0 / 5 - 0 ratings

Related issues

luc-github picture luc-github  路  4Comments

ESP32DE picture ESP32DE  路  4Comments

hex007 picture hex007  路  4Comments

kylefelipe picture kylefelipe  路  3Comments

beriberikix picture beriberikix  路  3Comments