Bug 2353125 - python-scikit-learn fails to build with Python 3.14: AssertionError in test_warn_if_metric_bool_data_no_bool and test_open_openml_url_retry_on_network_error
Summary: python-scikit-learn fails to build with Python 3.14: AssertionError in test_w...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: python-scikit-learn
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Sergio Pascual
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.14
TreeView+ depends on / blocked
 
Reported: 2025-03-18 09:50 UTC by Karolina Surma
Modified: 2025-03-18 12:42 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Karolina Surma 2025-03-18 09:50:43 UTC
python-scikit-learn fails to build with Python 3.14.0a6.

____________________ test_warn_if_metric_bool_data_no_bool _____________________

    def test_warn_if_metric_bool_data_no_bool():
        # make sure a *single* conversion warning is raised if metric is boolean
        # but data isn't
        # non-regression test for
        # https://github.com/scikit-learn/scikit-learn/issues/18996
    
        pairwise_metric = "rogerstanimoto"
        X = np.random.randint(2, size=(5, 2), dtype=np.int32)
        msg = f"Data will be converted to boolean for metric {pairwise_metric}"
    
        with pytest.warns(DataConversionWarning, match=msg) as warn_record:
            OPTICS(metric=pairwise_metric).fit(X)
>           assert len(warn_record) == 1
E           assert 2 == 1
E            +  where 2 = len(WarningsChecker(record=True))

sklearn/cluster/tests/test_optics.py:256: AssertionError
_________________ test_open_openml_url_retry_on_network_error __________________

monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f5f936034d0>

    def test_open_openml_url_retry_on_network_error(monkeypatch):
        def _mock_urlopen_network_error(request, *args, **kwargs):
            raise HTTPError(
                url=None, code=404, msg="Simulated network error", hdrs=None, fp=BytesIO()
            )
    
        monkeypatch.setattr(
            sklearn.datasets._openml, "urlopen", _mock_urlopen_network_error
        )
    
        invalid_openml_url = "invalid-url"
    
        with pytest.warns(
            UserWarning,
            match=re.escape(
                "A network error occurred while downloading"
                f" {_OPENML_PREFIX + invalid_openml_url}. Retrying..."
            ),
        ) as record:
            with pytest.raises(HTTPError, match="Simulated network error"):
                _open_openml_url(invalid_openml_url, None, delay=0)
>           assert len(record) == 3
E           assert 7 == 3
E            +  where 7 = len(WarningsChecker(record=True))

https://docs.python.org/3.14/whatsnew/3.14.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.14/fedora-rawhide-x86_64/08783526-python-scikit-learn/

For all our attempts to build python-scikit-learn with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/package/python-scikit-learn/

Testing and mass rebuild of packages is happening in copr.
You can follow these instructions to test locally in mock if your package builds with Python 3.14:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/

Let us know here if you have any questions.

Python 3.14 is planned to be included in Fedora 43.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires),
so if this package is required a lot, it's important for us to get it fixed soon.

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.


Note You need to log in before you can comment on or make changes to this bug.