Add certifi SSL fallback for urlopen - #3363
Closed
C-Achard wants to merge 2 commits into
Closed
Conversation
### Motivation The latest Ci runner on Windows seems to be having issues with the default SSL context, currently it fails while loading certificates from the Windows certificate store with ```python ssl.SSLError: [ASN1: NOT_ENOUGH_DATA] not enough data ``` ### Fix Import ssl and add _urlopen_with_certifi_fallback in tests/conftest.py to handle ssl.SSLError by falling back to an SSLContext using certifi's CA bundle. Replace direct urllib.request.urlopen call in unzip_from_url with the helper so test data downloads succeed on systems with incomplete SSL trust stores; re-raise the original error if certifi is not available.
Collaborator
Author
|
This requires broader patching as in c494945, since the failure affects everything including torch hub downloads. We might want to revert this patch once a fix is released for Win runners, |
deruyter92
approved these changes
Jun 11, 2026
Collaborator
|
Good fix for now! Let's merge as soon as possible so we can use CI |
Collaborator
Author
|
@deruyter92 I think this is fixed now since CI works in other PRs? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The latest Ci runner on Windows seems to be having issues with the default SSL context, currently it fails while loading certificates from the Windows certificate store with
Fix
Import ssl and add _urlopen_with_certifi_fallback in tests/conftest.py to handle ssl.SSLError by falling back to an SSLContext using certifi's CA bundle. Replace direct urllib.request.urlopen call in unzip_from_url with the helper so test data downloads succeed on systems with incomplete SSL trust stores; re-raise the original error if certifi is not available.