Page 1 of 1

Loading packages from Thonny

Posted: Fri Oct 01, 2021 5:54 pm
by mjrx
I know this question has been asked, but days of searching I cannot find a solution. When I try to install a package from "Manage Packages" I get:
Traceback (most recent call last):
File "C:\Projects\MicroPython\Thonny\lib\urllib\request.py", line 1350, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "C:\Projects\MicroPython\Thonny\lib\http\client.py", line 1277, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:\Projects\MicroPython\Thonny\lib\http\client.py", line 1323, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "C:\Projects\MicroPython\Thonny\lib\http\client.py", line 1272, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\Projects\MicroPython\Thonny\lib\http\client.py", line 1032, in _send_output
self.send(msg)
File "C:\Projects\MicroPython\Thonny\lib\http\client.py", line 972, in send
self.connect()
File "C:\Projects\MicroPython\Thonny\lib\http\client.py", line 1447, in connect
server_hostname=server_hostname)
File "C:\Projects\MicroPython\Thonny\lib\ssl.py", line 423, in wrap_socket
session=session
File "C:\Projects\MicroPython\Thonny\lib\ssl.py", line 870, in _create
self.do_handshake()
File "C:\Projects\MicroPython\Thonny\lib\ssl.py", line 1139, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1091)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Projects\MicroPython\Thonny\lib\tkinter\__init__.py", line 1705, in __call__
return self.func(*args)
File "C:\Projects\MicroPython\Thonny\lib\tkinter\__init__.py", line 749, in callit
func(*args)
File "C:\Projects\MicroPython\Thonny\lib\site-packages\thonny\plugins\micropython\pip_gui.py", line 388, in poll_fetch_complete
_, bin_data = url_future.result()
File "C:\Projects\MicroPython\Thonny\lib\concurrent\futures\_base.py", line 428, in result
return self.__get_result()
File "C:\Projects\MicroPython\Thonny\lib\concurrent\futures\_base.py", line 384, in __get_result
raise self._exception
File "C:\Projects\MicroPython\Thonny\lib\concurrent\futures\thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "C:\Projects\MicroPython\Thonny\lib\site-packages\thonny\plugins\pip_gui.py", line 1224, in load_url
with urlopen(url, timeout=timeout) as conn:
File "C:\Projects\MicroPython\Thonny\lib\urllib\request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "C:\Projects\MicroPython\Thonny\lib\urllib\request.py", line 525, in open
response = self._open(req, data)
File "C:\Projects\MicroPython\Thonny\lib\urllib\request.py", line 543, in _open
'_open', req)
File "C:\Projects\MicroPython\Thonny\lib\urllib\request.py", line 503, in _call_chain
result = func(*args)
File "C:\Projects\MicroPython\Thonny\lib\urllib\request.py", line 1393, in https_open
context=self._context, check_hostname=self._check_hostname)
File "C:\Projects\MicroPython\Thonny\lib\urllib\request.py", line 1352, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1091)>

No matter what package I try to install. Is there a solution to this?

Re: Loading packages from Thonny

Posted: Fri Oct 01, 2021 6:20 pm
by mjrx
Using Thonny v3.3.3, Micropython v1.17 on Pico board

Re: Loading packages from Thonny

Posted: Sat Oct 02, 2021 11:50 am
by j4dice001
Similar issue here when trying to download the Micropython firmware.

Downloading 563200 bytes from https://micropython.org/resources/firmw ... -v1.17.uf2

Traceback (most recent call last):
File "C:\Program Files (x86)\Thonny\lib\urllib\request.py", line 1350, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "C:\Program Files (x86)\Thonny\lib\http\client.py", line 1277, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:\Program Files (x86)\Thonny\lib\http\client.py", line 1323, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "C:\Program Files (x86)\Thonny\lib\http\client.py", line 1272, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\Program Files (x86)\Thonny\lib\http\client.py", line 1032, in _send_output
self.send(msg)
File "C:\Program Files (x86)\Thonny\lib\http\client.py", line 972, in send
self.connect()
File "C:\Program Files (x86)\Thonny\lib\http\client.py", line 1447, in connect
server_hostname=server_hostname)
File "C:\Program Files (x86)\Thonny\lib\ssl.py", line 423, in wrap_socket
session=session
File "C:\Program Files (x86)\Thonny\lib\ssl.py", line 870, in _create
self.do_handshake()
File "C:\Program Files (x86)\Thonny\lib\ssl.py", line 1139, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1091)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\micropython\uf2dialog.py", line 271, in _perform_work
self._download_to_the_device(download_url, size, target_dir)
File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\micropython\uf2dialog.py", line 333, in _download_to_the_device
with urlopen(req, timeout=5) as fsrc:
File "C:\Program Files (x86)\Thonny\lib\urllib\request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "C:\Program Files (x86)\Thonny\lib\urllib\request.py", line 525, in open
response = self._open(req, data)
File "C:\Program Files (x86)\Thonny\lib\urllib\request.py", line 543, in _open
'_open', req)
File "C:\Program Files (x86)\Thonny\lib\urllib\request.py", line 503, in _call_chain
result = func(*args)
File "C:\Program Files (x86)\Thonny\lib\urllib\request.py", line 1393, in https_open
context=self._context, check_hostname=self._check_hostname)
File "C:\Program Files (x86)\Thonny\lib\urllib\request.py", line 1352, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1091)>

Re: Loading packages from Thonny

Posted: Sat Oct 02, 2021 12:45 pm
by aivarannamaa
I could reproduce this only in one of my Windows machines (which has not been updated for a while).

Found a similar report: https://github.com/Rapptz/discord.py/is ... -636365993 which hints that Windows update may help.

Re: Loading packages from Thonny

Posted: Sat Oct 02, 2021 3:27 pm
by j4dice001
Thanks. Windows is all up-to-date on this machine, so that doesn't appear to be the issue.

Re: Loading packages from Thonny

Posted: Wed Oct 06, 2021 1:22 pm
by Poul Erik
I have the exact same issue. Windows 10, no pending update.

Re: Loading packages from Thonny

Posted: Wed Oct 06, 2021 1:25 pm
by Poul Erik
I have the exact same issue.

New raspberry pi pico, updating firmware v1.17 (2021-09-02)

Windows 10, no pending updates.

Re: Loading packages from Thonny

Posted: Wed Oct 06, 2021 2:07 pm
by aivarannamaa
It looks like for some reason, some instances of Windows haven't updated root certificates so far. In my case I could overcome this by manually installing updated https://letsencrypt.org/certs/lets-encrypt-r3.der

See https://github.com/thonny/thonny/issues/1986 for discussion

Re: Loading packages from Thonny

Posted: Fri Oct 15, 2021 8:05 pm
by Poul Erik
I can confirm that. Using another windows 10 machine. Same windows 10, same update level. Only difference: It worked