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

Certificate error when running comic.py #151

Open
sillik7 opened this issue Oct 7, 2024 · 9 comments
Open

Certificate error when running comic.py #151

sillik7 opened this issue Oct 7, 2024 · 9 comments

Comments

@sillik7
Copy link

sillik7 commented Oct 7, 2024

When running "python comic.py", I get the following error message:

Downloading: "https://huggingface.co/ogkalu/comic-text-segmenter-yolov8m/resolve/main/comic-text-segmenter.pt" to D:\Programs\comic-translate-main\comic-translate-main\models\detection
Traceback (most recent call last):
  File "C:\Users\...\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\...\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1283, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "C:\Users\...\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1329, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "C:\Users\...\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1278, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "C:\Users\...\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1038, in _send_output
    self.send(msg)
  File "C:\Users\...\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 976, in send
    self.connect()
  File "C:\Users\...\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1455, in connect
    self.sock = self._context.wrap_socket(self.sock,
  File "C:\Users\...\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 513, in wrap_socket
    return self.sslsocket_class._create(
  File "C:\Users\...\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1071, in _create
    self.do_handshake()
  File "C:\Users\...\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:1007)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Programs\comic-translate-main\comic-translate-main\comic.py", line 37, in <module>
    get_models(model)
  File "D:\Programs\comic-translate-main\comic-translate-main\modules\utils\download.py", line 47, in get_models
    download_url_to_file(file_url, file_path, hash_prefix=None, progress=True)
  File "C:\Users\...\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\hub.py", line 624, in download_url_to_file
    u = urlopen(req)
  File "C:\Users\...\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Users\...\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 525, in open
    response = meth(req, response)
  File "C:\Users\...\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 634, in http_response
    response = self.parent.error(
  File "C:\Users\...\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 557, in error
    result = self._call_chain(*args)
  File "C:\Users\...\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 496, in _call_chain
    result = func(*args)
  File "C:\Users\...\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 749, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "C:\Users\...\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 519, in open
    response = self._open(req, data)
  File "C:\Users\...\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\...\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 496, in _call_chain
    result = func(*args)
  File "C:\Users\...\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\...\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:1007)>
@sillik7 sillik7 changed the title QtWidgets DLL load error when running comic.py <delete> Oct 7, 2024
@sillik7 sillik7 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 7, 2024
@sillik7 sillik7 reopened this Oct 7, 2024
@sillik7 sillik7 closed this as completed Oct 7, 2024
@sillik7 sillik7 changed the title <delete> <delete this> Oct 7, 2024
@sillik7 sillik7 changed the title <delete this> Certificate error when running comic.py Oct 7, 2024
@sillik7 sillik7 reopened this Oct 7, 2024
@NightGamepro
Copy link

нашли как решить?

@sillik7
Copy link
Author

sillik7 commented Oct 12, 2024

нашли как решить?

A workaround is to download the files manually (via your browser) and put them in the right folders.
For example:
https://huggingface.co/ogkalu/comic-text-segmenter-yolov8m/resolve/main/comic-text-segmenter.pt
to
comic-translate-main\models\detection

@NightGamepro
Copy link

Can you please tell me what to download when certificate error occurs?

@SndSpctr
Copy link

Hey there, got the same error and feel kinda stuck, could you help me with that stacktrace please ?

python3 comic.py
Downloading: "https://huggingface.co/dreMaz/AnimeMangaInpainting/resolve/main/lama_large_512px.ckpt" to /Users/userxyz/Desktop/comics_machin/comic-translate/models/inpainting
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 1344, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1336, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1382, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1331, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1091, in _send_output
    self.send(msg)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1035, in send
    self.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1477, in connect
    self.sock = self._context.wrap_socket(self.sock,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 455, in wrap_socket
    return self.sslsocket_class._create(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 1041, in _create
    self.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 1319, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/userxyz/Desktop/comics_machin/comic-translate/comic.py", line 38, in <module>
    get_models(model)
  File "/Users/userxyz/Desktop/comics_machin/comic-translate/modules/utils/download.py", line 47, in get_models
    download_url_to_file(file_url, file_path, hash_prefix=None, progress=True)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/torch/hub.py", line 620, in download_url_to_file
    u = urlopen(req)
        ^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 215, in urlopen
    return opener.open(url, data, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 515, in open
    response = self._open(req, data)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 532, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 492, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 1392, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 1347, 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:1000)>

@sillik7
Copy link
Author

sillik7 commented Oct 14, 2024

Copy the url "https://huggingface.co/dreMaz/AnimeMangaInpainting/resolve/main/lama_large_512px.ckpt" to your browser, in order to download the file (lama_large_512px.ckpt) to your computer.
Then move the downloaded file into the "/Users/userxyz/Desktop/comics_machin/comic-translate/models/inpainting" folder.
If another certificate error occurs, do the same thing - check the URL and the destination folder from the stack trace.

@Caro24000
Copy link

Hello; I tried this but it doesn't work for me and I had the same error :
File "C:\Users\easypx\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 1347, 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:1000)>

@Caro24000
Copy link

Can anyone tell me what's wrong with this ? (ran with PowerShell on Windows 11)
I used more different ways ( pip install --upgrade certifi ; the silllik7 methods ; with and without torch ; with and without -venv... etc... and few hours spent for searching a fix on the Web). If someone could help me (step by step) please

(comic-translate-venv) PS C:\Users\easypx\comic-translate> python comic.py
Downloading: "https://huggingface.co/ogkalu/comic-speech-bubble-detector-yolov8m/resolve/main/comic-speech-bubble-detector.pt" to C:\Users\easypx\comic-translate\models\detection
Traceback (most recent call last):
File "C:\Users\easypx\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 1344, in do_open
h.request(req.get_method(), req.selector, req.data, headers,
File "C:\Users\easypx\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1336, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:\Users\easypx\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1382, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "C:\Users\easypx\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1331, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\Users\easypx\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1091, in _send_output
self.send(msg)
File "C:\Users\easypx\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1035, in send
self.connect()
File "C:\Users\easypx\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1477, in connect
self.sock = self._context.wrap_socket(self.sock,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\easypx\AppData\Local\Programs\Python\Python312\Lib\ssl.py", line 455, in wrap_socket
return self.sslsocket_class._create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\easypx\AppData\Local\Programs\Python\Python312\Lib\ssl.py", line 1042, in _create
self.do_handshake()
File "C:\Users\easypx\AppData\Local\Programs\Python\Python312\Lib\ssl.py", line 1320, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\easypx\comic-translate\comic.py", line 44, in
get_models(model)
File "C:\Users\easypx\comic-translate\modules\utils\download.py", line 47, in get_models
download_url_to_file(file_url, file_path, hash_prefix=None, progress=True)
File "C:\Users\easypx\comic-translate-venv\Lib\site-packages\torch\hub.py", line 708, in download_url_to_file
u = urlopen(req)
^^^^^^^^^^^^
File "C:\Users\easypx\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 215, in urlopen
return opener.open(url, data, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\easypx\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 521, in open
response = meth(req, response)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\easypx\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 630, in http_response
response = self.parent.error(
^^^^^^^^^^^^^^^^^^
File "C:\Users\easypx\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 553, in error
result = self._call_chain(*args)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\easypx\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 492, in _call_chain
result = func(*args)
^^^^^^^^^^^
File "C:\Users\easypx\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 745, in http_error_302
return self.parent.open(new, timeout=req.timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\easypx\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 515, in open
response = self._open(req, data)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\easypx\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 532, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\easypx\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 492, in _call_chain
result = func(*args)
^^^^^^^^^^^
File "C:\Users\easypx\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 1392, in https_open
return self.do_open(http.client.HTTPSConnection, req,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\easypx\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 1347, 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:1000)>

@ogkalu2
Copy link
Owner

ogkalu2 commented Nov 29, 2024

@Caro24000 This is hacky but you can do what @sillik7 said and:

  • Open comic.py and on line 43/44, remove this line(s):
    for model in mandatory_models:
    get_models(model)

@Caro24000
Copy link

@ogkalu2 It works !!! You're my King. THANK YOU

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

5 participants