Skip to content

Commit

Permalink
Fix SSL error. (#6177)
Browse files Browse the repository at this point in the history
Last night, [wheel-tests-cuml / 11.8.0, 3.10, arm64, rockylinux8, a100,
latest-driver,
oldest-deps](https://github.com/rapidsai/cuml/actions/runs/12273029767/job/34243006376#logs)
failed.

The failure occurred in `testing/dask/utils.py`'s `load_text_corpus`:


https://github.com/rapidsai/cuml/blob/052cddef9648c3266974a0b43970afb347ba9d01/python/cuml/cuml/testing/dask/utils.py#L12

The errors looked like:

```
FAILED test_dask_naive_bayes.py::test_basic_fit_predict - urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)>
FAILED test_dask_naive_bayes.py::test_single_distributed_exact_results - urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)>
FAILED test_dask_naive_bayes.py::test_score - urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)>
```

This adopts some fixes from
rapidsai/cugraph#4825 that will hopefully help
with SSL certificate failures.
  • Loading branch information
bdice authored Dec 11, 2024
1 parent 70c04d9 commit 6dfc61b
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions conda/environments/all_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ channels:
- nvidia
dependencies:
- c-compiler
- certifi
- cmake>=3.26.4,!=3.30.0
- cuda-python>=11.7.1,<12.0a0,<=11.8.3
- cuda-version=11.8
Expand Down
1 change: 1 addition & 0 deletions conda/environments/all_cuda-125_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ channels:
- nvidia
dependencies:
- c-compiler
- certifi
- cmake>=3.26.4,!=3.30.0
- cuda-cudart-dev
- cuda-nvcc
Expand Down
1 change: 1 addition & 0 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ dependencies:
common:
- output_types: [conda, requirements, pyproject]
packages:
- certifi
- *cython
- dask-ml
- hdbscan>=0.8.39,<0.8.40
Expand Down
11 changes: 11 additions & 0 deletions python/cuml/cuml/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
from sklearn.utils import Bunch
from datetime import timedelta
from math import ceil
from ssl import create_default_context
from urllib.request import build_opener, HTTPSHandler, install_opener
import certifi
import hypothesis
from cuml.internals.safe_imports import gpu_only_import
import pytest
Expand All @@ -41,6 +44,14 @@
# Add the import here for any plugins that should be loaded EVERY TIME
pytest_plugins = "cuml.testing.plugins.quick_run_plugin"


# Install SSL certificates
def pytest_sessionstart(session):
ssl_context = create_default_context(cafile=certifi.where())
https_handler = HTTPSHandler(context=ssl_context)
install_opener(build_opener(https_handler))


CI = os.environ.get("CI") in ("true", "1")
HYPOTHESIS_ENABLED = os.environ.get("HYPOTHESIS_ENABLED") in (
"true",
Expand Down
10 changes: 10 additions & 0 deletions python/cuml/cuml/tests/dask/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Copyright (c) 2020-2024, NVIDIA CORPORATION.

import certifi
import pytest
from ssl import create_default_context
from urllib.request import build_opener, HTTPSHandler, install_opener

from dask_cuda import initialize
from dask_cuda import LocalCUDACluster
Expand All @@ -12,6 +15,13 @@
enable_infiniband = False


# Install SSL certificates
def pytest_sessionstart(session):
ssl_context = create_default_context(cafile=certifi.where())
https_handler = HTTPSHandler(context=ssl_context)
install_opener(build_opener(https_handler))


@pytest.fixture(scope="module")
def cluster():

Expand Down
1 change: 1 addition & 0 deletions python/cuml/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ classifiers = [

[project.optional-dependencies]
test = [
"certifi",
"cython>=3.0.0",
"dask-ml",
"hdbscan>=0.8.39,<0.8.40",
Expand Down

0 comments on commit 6dfc61b

Please sign in to comment.