[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate

I’m getting the following error on MacOS on VSCode as shown below:

Verbose mode can be enabled via -v, --verbose option
Downloading json2cpp from https://github.com/lefticus/json2cpp/releases/download/snapshot-fc69acfd190ff0aa23689fae339ed89db4c3ed75/json2cpp-0.0.1-fc69acfd-Darwin-Release-GNU-11.3.0.tar.bz2
URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)>:

I installed the official Python release and ran the install certificate command. Unfortunately, the error persists since PIO is running its own Python 3.9.9 located at

/Users/jessbauer/.platformio/penv/bin/python

I assume the certificate needs to be installed specifically for it.
How do I resolve this? I am not running any proxies I know of.

Could you close VSCode, remove the following folders and start VSCode?

  • /Users/jessbauer/.platformio/python3
  • /Users/jessbauer/.platformio/penv

It should use the latest Python 3.11.7.

Weird, when the Github Actions CI ran the script it went through.

https://github.com/maxgerhardt/pio-json2cpp/actions/runs/7422918389/job/20199221481

When I relaunched VS Code, it reinstalled the previous python environment again.

I’m getting the same error again. This time the python version has been upgraded. Interestingly,

Hm. I can work-around it by disabling verfification but per https://support.chainstack.com/hc/en-us/articles/9117198436249-Common-SSL-Issues-on-Python-and-How-to-Fix-it and the log above, installing / upgrading certifi does update the SSL certificates and it should work. Maybe you need to just execute pip install –upgrade certifi in python environment for PlatformIO? But again, the MacOS machine used in Github Actions didn’t need this…

Edit: I’ve pushed https://github.com/maxgerhardt/pio-json2cpp/commit/9b4562efd68a3447aa23a83df5a017843af3a28d against this.

I’ve tried everything I even uninstalled and installed it. I did this:

% python -m pip install --upgrade pip

Requirement already satisfied: pip in /Users/jessbauer/.platformio/penv/lib/python3.11/site-packages (23.3.2)

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)’))’: /simple/pip/

WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)’))’: /simple/pip/

WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)’))’: /simple/pip/

WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)’))’: /simple/pip/

WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)’))’: /simple/pip/

Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=‘pypi.org’, port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)’))) - skipping

I had to blow out the entire installation created by PlatformIO VSCode Extension as well as the extension itself. I then installed PlatformIO again via brew and the error is gone. I was able to reinstall the extension.

1 Like

I don’t how, but the error returned in VSCode, but not in the command line.