[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)>

Hi;
I’ve been stuck for a few days trying to do Jeremy Howard’s video tutorial. This is proving to be a bit of an arcano for me, difficult to solve and I’m starting to think about giving up.

My computer is a MacBook Pro m1. I decided to do the whole initial process through my terminal and not with GitHub Desktop. I created a repo on GitHub and imported it with the command ‘git clone…’ to my computer.
I think I have all the requirements of nbdev. Where I get stuck is at minute 8.38 when I create nbdev inside the path of my repo with the nbdev_new -h instance.
I get the following output :

my-nbdev-repo % nbdev_new
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/ghapi/core.py:101: UserWarning: Neither GITHUB_TOKEN nor GITHUB_JWT_TOKEN found: running as unauthenticated
  else: warn('Neither GITHUB_TOKEN nor GITHUB_JWT_TOKEN found: running as unauthenticated')
repo = my-nbdev-repo # Automatically inferred from git
# Please enter a value for branch
branch = my-repo
user = twistin # Automatically inferred from git
# Please enter a value for author
author = sdcarr
# Please enter a value for author_email
author_email = sarersac@            
# Please enter a value for description
description = dwcececfce
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nbdev/config.py:173: UserWarning: Config file already exists: /Users/sdcarr/my-nbdev-repo/settings.ini and will be used as a base
  if cfg.config_file.exists(): warn(f'Config file already exists: {cfg.config_file} and will be used as a base')
settings.ini created.
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1348, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1282, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1328, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1277, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1037, in _send_output
    self.send(msg)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 975, in send
    self.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1454, in connect
    self.sock = self._context.wrap_socket(self.sock,
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 513, in wrap_socket
    return self.sslsocket_class._create(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1071, in _create
    self.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1342, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/bin/nbdev_new", line 8, in <module>
    sys.exit(nbdev_new())
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/fastcore/script.py", line 119, in _f
    return tfunc(**merge(args, args_from_prog(func, xtra)))
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nbdev/cli.py", line 90, in nbdev_new
    tag = GhApi(gh_host='https://api.github.com', authenticate=False).repos.get_latest_release('fastai', 'nbdev-template').tag_name
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/ghapi/core.py", line 61, in __call__
    return self.client(self.path, self.verb, headers=headers, route=route_p, query=query_p, data=data_p)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/ghapi/core.py", line 120, in __call__
    res,self.recv_hdrs = urlsend(path, verb, headers=headers or None, debug=debug, return_headers=True,
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/fastcore/net.py", line 218, in urlsend
    return urlread(req, return_json=return_json, return_headers=return_headers)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/fastcore/net.py", line 117, in urlread
    with urlopen(url, data=data, headers=headers, timeout=timeout, **kwargs) as u: res,hdrs = u.read(),u.headers
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/fastcore/net.py", line 108, in urlopen
    try: return urlopener().open(urlwrap(url, data=data, headers=headers), timeout=timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 519, in open
    response = self._open(req, data)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 536, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 496, in _call_chain
    result = func(*args)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1391, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1351, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)>
sdcarr@MacBook-...- my-nbdev-repo % 

Please could someone help me?
Thank you

I don’t have a Mac, so can’t help you directly. But can share a tip…

Can you summarise the things you’ve already tried from this search?
This will help optmise the time of those that would like to help you.

Please also read HTAQTSW.

Also btw, Jeremy had done a lot of videos, so being more specific with a link may help readers answer you. Also, if you get to the point of giving up on your Mac, Jeremy advises its easier to get started by using the cloud based services - e.g. Kaggle, Paperspace, Colab.

I am having a similar issue trying to follow the nbdev_cards tutorial (on macbook with M1). I also get the first error message but not the rest.

When I run the nbdev_new command from the repo directory I get the following error:
UserWarning: Neither GITHUB_TOKEN nor GITHUB_JWT_TOKEN found: running as unauthenticated

I am then prompted to add a description even though the repo has a description already (this does not occur in the video). It then proceeds to create the files as normal. At first this doesn’t seem to cause an issue, but later in the tutorial issues arise and I am not sure if they are related (i.e. index.ipynb cannot import the card.py file created using nbdev_export).

Hello, I have solved the issue. After searching for answers in several forums including this one, I found no solution. I decided to install ‘Conda’ and by following all the steps again everything seems to work correctly. I don’t know if the issue had something to do with the python path. I hope it helps!
Good luck

2 Likes

I tried it again with Conda instead of pip for installs and have the same issues. Updated conda and anaconda as well.

I forgot to mention that it also re-creates Github public and private keys, have you checked that your Github SSH keys are correct?