Mikubill / sd-webui-controlnet

WebUI extension for ControlNet
GNU General Public License v3.0
16.43k stars 1.91k forks source link

[Bug]: urllib.error.URLError when using preprocessors #2292

Open FugueSegue opened 7 months ago

FugueSegue commented 7 months ago

Is there an existing issue for this?

What happened?

On a new fresh install of Automatix1111, and the extension, I am getting the following error:

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

Steps to reproduce the problem

Loading most of the pre-processors in ControlNet reproduces the problem. Depth definitely does not work. Canny does work.

What should have happened?

There should be no errors, and ControlNet pre-processors should work as intended.

Commit where the problem happens

webui: 1.6.0 controlnet: 1.1

What browsers do you use to access the UI ?

Microsoft Edge

Command Line Arguments

n/a

List of enabled extensions

sd-webui-controlnet is the only extension I installed.

Console logs

venv "C:\ai\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Version: v1.6.1
Commit hash: 4afaaf8a020c1df457bcf7250cb1c7f609699fa7
Launching Web UI with arguments: --ckpt-dir C:\ai\models\checkpoints --lora-dir C:\ai\models\loras --vae-dir C:\ai\models\vae
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
2023-12-05 13:44:25,463 - ControlNet - INFO - ControlNet v1.1.419
ControlNet preprocessor location: C:\ai\stable-diffusion-webui\extensions\sd-webui-controlnet\annotator\downloads
2023-12-05 13:44:25,510 - ControlNet - INFO - ControlNet v1.1.419
Calculating sha256 for C:\ai\models\checkpoints\april_231128a_g1bcD.safetensors: Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 6.6s (prepare environment: 1.5s, import torch: 2.0s, import gradio: 0.6s, setup paths: 0.6s, initialize shared: 0.2s, other imports: 0.4s, list SD models: 0.2s, load scripts: 0.7s, create ui: 0.3s, gradio launch: 0.2s).
32d83a7a1b24edf9fc65c1a014614750b5d1d1d841d4fc5c849c2d5c2313edad
Loading weights [32d83a7a1b] from C:\ai\models\checkpoints\april_231128a_g1bcD.safetensors
Creating model from config: C:\ai\stable-diffusion-webui\configs\v1-inference.yaml
Calculating sha256 for C:\ai\models\checkpoints\v1-5-pruned.safetensors: Applying attention optimization: Doggettx... done.
Model loaded in 10.4s (calculate hash: 4.6s, load weights from disk: 0.2s, create model: 0.2s, apply weights to model: 2.6s, apply half(): 1.5s, load VAE: 0.2s, calculate empty prompt: 1.1s).
1a189f0be69d6106a48548e7626207dddd7042a418dbf372cefd05e0cdba61b6
Loading weights [1a189f0be6] from C:\ai\models\checkpoints\v1-5-pruned.safetensors
Creating model from config: C:\ai\stable-diffusion-webui\configs\v1-inference.yaml
Applying attention optimization: Doggettx... done.
Model loaded in 3.7s (create model: 0.4s, apply weights to model: 3.0s).
2023-12-05 13:45:08,680 - ControlNet - INFO - Preview Resolution = 512
Downloading: "https://huggingface.co/lllyasviel/ControlNet/resolve/main/annotator/ckpts/dpt_hybrid-midas-501f0c75.pt" to C:\ai\stable-diffusion-webui\extensions\sd-webui-controlnet\annotator\downloads\midas\dpt_hybrid-midas-501f0c75.pt

Traceback (most recent call last):
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 1348, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1282, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1328, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1277, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1037, in _send_output
    self.send(msg)
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 975, in send
    self.connect()
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1454, in connect
    self.sock = self._context.wrap_socket(self.sock,
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 513, in wrap_socket
    return self.sslsocket_class._create(
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1071, in _create
    self.do_handshake()
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\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 "C:\ai\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict
    output = await app.get_blocks().process_api(
  File "C:\ai\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1431, in process_api
    result = await self.call_function(
  File "C:\ai\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1103, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "C:\ai\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "C:\ai\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "C:\ai\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "C:\ai\stable-diffusion-webui\venv\lib\site-packages\gradio\utils.py", line 707, in wrapper
    response = f(*args, **kwargs)
  File "C:\ai\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\controlnet_ui\controlnet_ui_group.py", line 694, in run_annotator
    result, is_image = preprocessor(
  File "C:\ai\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\utils.py", line 75, in decorated_func
    return cached_func(*args, **kwargs)
  File "C:\ai\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\utils.py", line 63, in cached_func
    return func(*args, **kwargs)
  File "C:\ai\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\global_state.py", line 37, in unified_preprocessor
    return preprocessor_modules[preprocessor_name](*args, **kwargs)
  File "C:\ai\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\processor.py", line 180, in midas
    result, _ = model_midas(img, a)
  File "C:\ai\stable-diffusion-webui\extensions\sd-webui-controlnet\annotator\midas\__init__.py", line 19, in apply_midas
    model = MiDaSInference(model_type="dpt_hybrid")
  File "C:\ai\stable-diffusion-webui\extensions\sd-webui-controlnet\annotator\midas\api.py", line 173, in __init__
    model, _ = load_model(model_type)
  File "C:\ai\stable-diffusion-webui\extensions\sd-webui-controlnet\annotator\midas\api.py", line 106, in load_model
    load_file_from_url(remote_model_path, model_dir=base_model_path)
  File "C:\ai\stable-diffusion-webui\venv\lib\site-packages\basicsr\utils\download_util.py", line 98, in load_file_from_url
    download_url_to_file(url, cached_file, hash_prefix=None, progress=progress)
  File "C:\ai\stable-diffusion-webui\venv\lib\site-packages\torch\hub.py", line 611, in download_url_to_file
    u = urlopen(req)
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 519, in open
    response = self._open(req, data)
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 536, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 496, in _call_chain
    result = func(*args)
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 1391, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "C:\Users\SAL\AppData\Local\Programs\Python\Python310\lib\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)>

Additional information

I saw someone have the exact same issue here but I have no idea if it was resolved.

Zhong921 commented 6 months ago

Is there a fix yet