aedocw / epub2tts

Turn an epub or text file into an audiobook
Apache License 2.0
528 stars 50 forks source link

urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain #231

Closed sejbk closed 5 months ago

sejbk commented 6 months ago

Hi,

Followed the installation guide for macOS and when I try to run the command I get a certificate error as follows from the stack trace. Any ideas on how to resolve?

Thanks.

epub2tts sample.txt
Namespace(sourcefile='sample.txt', engine='tts', xtts=None, openai=None, model='tts_models/en/vctk/vits', speaker=None, scan=False, start=1, end=999, language='en', minratio=88, skiplinks=False, skipfootnotes=False, sayparts=False, audioformat='m4b', bitrate='69k', debug=False, export=None, no_deepspeed=False, skip_cleanup=False, cover=None) Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/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.11/lib/python3.11/http/client.py", line 1286, in request self._send_request(method, url, body, headers, encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1332, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1281, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1041, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 979, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1458, in connect self.sock = self._context.wrap_socket(self.sock, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py", line 517, in wrap_socket return self.sslsocket_class._create( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py", line 1075, in _create self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py", line 1346, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1002)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/jonas/Develop/epub2tts/.venv/bin/epub2tts", line 8, in sys.exit(main()) ^^^^^^ File "/Users/jonas/Develop/epub2tts/.venv/lib/python3.11/site-packages/epub2tts.py", line 852, in main mybook = EpubToAudiobook( ^^^^^^^^^^^^^^^^ File "/Users/jonas/Develop/epub2tts/.venv/lib/python3.11/site-packages/epub2tts.py", line 89, in init self.whispermodel = whisper.load_model("tiny") ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/jonas/Develop/epub2tts/.venv/lib/python3.11/site-packages/whisper/init.py", line 133, in load_model checkpoint_file = _download(_MODELS[name], download_root, in_memory) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/jonas/Develop/epub2tts/.venv/lib/python3.11/site-packages/whisper/init.py", line 69, in _download with urllib.request.urlopen(url) as source, open(download_target, "wb") as output: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 216, in urlopen return opener.open(url, data, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 519, in open response = self._open(req, data) ^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 536, in _open result = self._call_chain(self.handle_open, protocol, protocol + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 496, in _call_chain result = func(*args) ^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 1391, in https_open return self.do_open(http.client.HTTPSConnection, req, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 1351, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1002)>

aedocw commented 6 months ago

Looks like whisper is failing to download the model it needs (only needs to do that the first time).

Could you pick a short wav or mp3 with speaking to try running a test transcript, and see if it throws an error? Try whisper --task transcribe --model tiny <your audio file>

sejbk commented 5 months ago

Thank you, found the problem. For anyone else, the resolution was to run the "Install Certificates.command" in the Python App folder.