Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSL: CERTIFICATE_VERIFY_FAILED on macOS Sonoma 14.5 AND on macOS Sequoia 15.0 beta 2 #35

Open
willandmei opened this issue Jun 27, 2024 · 1 comment

Comments

@willandmei
Copy link

When using python3 app.py on macOS (the supplied web interface to resemble-enhance,
when using a public shared link OR when using localhost:7860,
the following error was seen in resemble-enhance/enhancer/download.py...
def download(run_dir: str | Path | None = None):

...

       torch.hub.download_url_to_file(url, str(path))   # <---- SSL CERTIFICATE_VERIFY_FAILED Error

IS THIS because macOS and Windows does not permit multiple redirects?
IS the only work-around at the moment to run from Linux?
Can this be run locally without having to ask the server which does multiple redirects?

Here is the detailed stack trace...
Downloads/resemble-enhance-main % python app.py
[2024-06-26 21:37:44,816] [INFO] [real_accelerator.py:161:get_accelerator] Setting ds_accelerator to mps (auto detect)
[2024-06-26 21:37:45,218] torch.distributed.elastic.multiprocessing.redirects: [WARNING] NOTE: Redirects are currently not supported in Windows or MacOs.
Running on local URL: http://127.0.0.1:7860
Running on public URL: https://02876e1f2a3e690306.gradio.live

This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run gradio deploy from Terminal to deploy to Spaces (https://huggingface.co/spaces)
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 1303, 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 1349, 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 1298, 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 1058, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 996, in send
self.connect()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1475, 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 1104, in _create
self.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py", line 1382, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/williammccarthy/.virtualenvs/asj/lib/python3.11/site-packages/gradio/queueing.py", line 541, in process_events
response = await route_utils.call_process_api(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/williammccarthy/.virtualenvs/asj/lib/python3.11/site-packages/gradio/route_utils.py", line 276, in call_process_api
output = await app.get_blocks().process_api(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/williammccarthy/.virtualenvs/asj/lib/python3.11/site-packages/gradio/blocks.py", line 1928, in process_api
result = await self.call_function(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/williammccarthy/.virtualenvs/asj/lib/python3.11/site-packages/gradio/blocks.py", line 1514, in call_function
prediction = await anyio.to_thread.run_sync(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/williammccarthy/.virtualenvs/asj/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/williammccarthy/.virtualenvs/asj/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread
return await future
^^^^^^^^^^^^
File "/Users/williammccarthy/.virtualenvs/asj/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 859, in run
result = context.run(func, *args)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/williammccarthy/.virtualenvs/asj/lib/python3.11/site-packages/gradio/utils.py", line 833, in wrapper
response = f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/Users/williammccarthy/Downloads/resemble-enhance-main/app.py", line 24, in _fn
wav1, new_sr = denoise(dwav, sr, device)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/williammccarthy/.virtualenvs/asj/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/williammccarthy/Downloads/resemble-enhance-main/resemble_enhance/enhancer/inference.py", line 29, in denoise
enhancer = load_enhancer(run_dir, device)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/williammccarthy/Downloads/resemble-enhance-main/resemble_enhance/enhancer/inference.py", line 16, in load_enhancer
run_dir = download(run_dir)
^^^^^^^^^^^^^^^^^
File "/Users/williammccarthy/Downloads/resemble-enhance-main/resemble_enhance/enhancer/download.py", line 48, in download
torch.hub.download_url_to_file(url, str(path))
File "/Users/williammccarthy/.virtualenvs/asj/lib/python3.11/site-packages/torch/hub.py", line 620, in download_url_to_file
u = urlopen(req)
^^^^^^^^^^^^
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: unable to get local issuer certificate (_ssl.c:1006)>

@willandmei
Copy link
Author

The submit button on the app.py app (as of this writing) works only on Linux -- I got it to work by installing VMWare Fusion on the macOS (Ubuntu 22), AND by installing Python 3.11 and pip 3.11 using deadsnakes, then created and activated a virtual environment using python 3.11 and ran it by typing python app.py. THEN I could call submit without it failing (but have patience: it took 40+ seconds to process a very short audio file.
Using macOS or Windows it would error out in less than 5 seconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant