stepcount icon indicating copy to clipboard operation
stepcount copied to clipboard

SSL: CERTIFICATE_VERIFY_FAILED

Open StephenLeonardGreen opened this issue 2 years ago • 5 comments

I had a fresh install of Windows 11, and after downloading the most recent versions of Python and Java as mentioned in the prerequisites, I followed the instructions mentioned here however when attempting to run the program on the example, I get this error.

(base) C:\Users\grims>stepcount sample.cwa.gz Decompressing... Done! (0.73s) Reading file... Done! (8.28s) Converting to dataframe... Done! (2.63s) Getting stationary points... Done! (5.96s) Gravity calibration... Done! (2.08s) Nonwear detection... Done! (5.11s) Resampling... Done! (1.92s) Downloading https://wearables-files.ndph.ox.ac.uk/files/models/stepcount/ssl-20230208.joblib.lzma... Traceback (most recent call last): File "C:\Users\grims\miniconda3\lib\urllib\request.py", line 1348, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "C:\Users\grims\miniconda3\lib\http\client.py", line 1282, in request self._send_request(method, url, body, headers, encode_chunked) File "C:\Users\grims\miniconda3\lib\http\client.py", line 1328, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "C:\Users\grims\miniconda3\lib\http\client.py", line 1277, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "C:\Users\grims\miniconda3\lib\http\client.py", line 1037, in _send_output self.send(msg) File "C:\Users\grims\miniconda3\lib\http\client.py", line 975, in send self.connect() File "C:\Users\grims\miniconda3\lib\http\client.py", line 1454, in connect self.sock = self._context.wrap_socket(self.sock, File "C:\Users\grims\miniconda3\lib\ssl.py", line 513, in wrap_socket return self.sslsocket_class._create( File "C:\Users\grims\miniconda3\lib\ssl.py", line 1071, in _create self.do_handshake() File "C:\Users\grims\miniconda3\lib\ssl.py", line 1342, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\grims\miniconda3\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\grims\miniconda3\lib\runpy.py", line 86, in run_code exec(code, run_globals) File "C:\Users\grims\miniconda3\Scripts\stepcount.exe_main.py", line 7, in File "C:\Users\grims\miniconda3\lib\site-packages\stepcount\stepcount.py", line 55, in main model = load_model(args.model_path or model_path, args.model_type, check_md5, args.force_download) File "C:\Users\grims\miniconda3\lib\site-packages\stepcount\stepcount.py", line 335, in load_model with urllib.request.urlopen(url) as f_src, open(pth, "wb") as f_dst: File "C:\Users\grims\miniconda3\lib\urllib\request.py", line 216, in urlopen return opener.open(url, data, timeout) File "C:\Users\grims\miniconda3\lib\urllib\request.py", line 519, in open response = self._open(req, data) File "C:\Users\grims\miniconda3\lib\urllib\request.py", line 536, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "C:\Users\grims\miniconda3\lib\urllib\request.py", line 496, in _call_chain result = func(*args) File "C:\Users\grims\miniconda3\lib\urllib\request.py", line 1391, in https_open return self.do_open(http.client.HTTPSConnection, req, File "C:\Users\grims\miniconda3\lib\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:997)>

StephenLeonardGreen avatar Apr 20 '23 19:04 StephenLeonardGreen

What version of python are you using? Is it 3.11? You can try python --version Is it MacOS? @angerhang I think you had a similar issue before.

chanshing avatar Apr 21 '23 10:04 chanshing

Yeah I suspect it is also the Python version that is not right. Make sure you use Python >= 3.8.

angerhang avatar Apr 21 '23 12:04 angerhang

I used the most recent version of Python which was 3.10.9 along with Java 1.8.0_361 and then followed the video using Miniconda3 on Windows as advised.

StephenLeonardGreen avatar Apr 21 '23 14:04 StephenLeonardGreen

@StephenLeonardGreen Are you able to download https://wearables-files.ndph.ox.ac.uk/files/models/stepcount/ssl-20230208.joblib.lzma from any browser? If you click the link, does it download a file?

chanshing avatar Apr 24 '23 20:04 chanshing

I was able to download the file separately but not through the code.

I just tried this again with the same Python/Java versions on a Windows 10 computer without an issue so I think the issue might be to do with Windows 11. Can anything be done about this?

StephenLeonardGreen avatar Apr 25 '23 00:04 StephenLeonardGreen

Try updating the certificates:

pip install --upgrade certifi

chanshing avatar Mar 04 '25 09:03 chanshing