Talip7/scikit-learn-issues-multilabel huggingface dataset:
Remove uneeded SKLEARN_BUILD_PARALLEL environment variable

This is only actually used if we build with setuptools and most of our CI builds are with Meson, i.e. the only setuptools build has `BUILD_WITH_SETUPTOOLS: 'true'`

Here are the usages of SKLEARN_BUILD_PARALLEL, most should be removed some should be kept (at least the one in `setup.py` and maybe the `azure/install.sh` although it could be only in the case of `BUILD_WITH_SETUPTOOLS == "true"`)
```
❯ git grep -P SKLEARN_BUILD_PARALLEL
.github/workflows/wheels.yml:            SKLEARN_BUILD_PARALLEL=3
.github/workflows/wheels.yml:          SKLEARN_BUILD_PARALLEL: 3
build_tools/azure/install.sh:    export SKLEARN_BUILD_PARALLEL=3
build_tools/circle/build_doc.sh:export SKLEARN_BUILD_PARALLEL=3
build_tools/cirrus/arm_wheel.yml:                      SKLEARN_BUILD_PARALLEL=5
build_tools/cirrus/build_test_arm.sh:export SKLEARN_BUILD_PARALLEL=$(($N_CORES + 1))
setup.py:            parallel = os.environ.get("SKLEARN_BUILD_PARALLEL")
```

COMMENT:
> Noob question, but does meson support parallel builds by default?

Yes it does and in a much nicer way than what we were doing before with setuptools

Labels: Build / CI, help wanted
Build wheels against Numpy 2 rather than numpy development version

Now that Numpy 2 has been released, I think we don't need to build against numpy-dev (we are using all dev dependencies so scipy-dev as well), i.e. we can revert https://github.com/scikit-learn/scikit-learn/pull/27735, i.e. I think we can just remove code like this:
```py
if [[ "$GITHUB_EVENT_NAME" == "schedule" || "$CIRRUS_CRON" == "nightly" ]]; then
    # Nightly build:  See also `../github/upload_anaconda.sh` (same branching).
    # To help with NumPy 2.0 transition, ensure that we use the NumPy 2.0
    # nightlies.  This lives on the edge and opts-in to all pre-releases.
    # That could be an issue, in which case no-build-isolation and a targeted
    # NumPy install may be necessary, instead.
    export CIBW_BUILD_FRONTEND='pip; args: --pre --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple"'
fi
```

cc @seberg who did the original PR, in case there may be a reason we want to wait a bit after Numpy 2.0 release and check whether I am not missing anything subtle.

COMMENT:
Yeah, I think you can just revert now, it was important in the transition, but now shouldn't matter anymore (for the next years :)).

Labels: Build / CI
ConvergenceWarnings cannot be turned off

Hi, I'm unable to turn off convergence warnings from `GraphicalLassoCV`.

I've tried most of the solutions from, and none of them worked (see below for actual implementations):
https://stackoverflow.com/questions/879173/how-to-ignore-deprecation-warnings-in-python
https://stackoverflow.com/questions/32612180/eliminating-warnings-from-scikit-learn/33812427#33812427
https://stackoverflow.com/questions/53968004/how-to-silence-all-sklearn-warning
https://stackoverflow.com/questions/14463277/how-to-disable-python-warnings

Contrary to what the designers of the sklearn's exceptions must have thought when it was implemented, some of us actually use stdout to log important information of the host program for diagnostics purposes.  Flooding it with garbage that cannot be turned off, as is in the case with cross-validation, is not ok. 

To briefly speak to the severity of the issue, the above sklearn-specific questions relating to suppressing warnings have been viewed ~500K times with combined ~400 upvotes, and dates back 7 years. 

I've tried the following (`n_jobs` parameter does not appear to affect the result):

```py
from sklearn.covariance import GraphicalLassoCV
import warnings
warnings.filterwarnings("ignore", category=ConvergenceWarning)

model = GraphicalLassoCV(n_jobs=4)
model = model.fit(data)
```

```py
from sklearn.covariance import GraphicalLassoCV
import warnings
warnings.filterwarnings(action='ignore')

model = GraphicalLassoCV(n_jobs=4)
model = model.fit(data)
```

```py
import warnings
with warnings.catch_warnings():
    warnings.simplefilter("ignore", ConvergenceWarning)

    model = GraphicalLassoCV(n_jobs=4)
    model = model.fit(data)
```

```py
from sklearn.covariance import GraphicalLassoCV
def warn(*args, **kwargs):
    pass
import warnings
warnings.warn = warn

model = GraphicalLassoCV(n_jobs=4)
model = model.fit(data)
```

```py
import contextlib
import os, sys

@contextlib.contextmanager
def suppress_stdout():
    with open(os.devnull, 'w') as fnull:
        old_stdout = sys.stdout
        sys.stdout = fnull
        try:
            yield
        finally:
            sys.stdout = old_stdout

with suppress_stdout():
    model = GraphicalLassoCV(n_jobs=4)
    model = model.fit(data)
```

```py
import logging
logging.captureWarnings(True)

logging.getLogger("py.warnings").setLevel(logging.ERROR)

model = GraphicalLassoCV(n_jobs=4)
model = model.fit(data)
```

COMMENT:
If you give a fully stand-alone example, in particular some `data` that triggers a warning, this may give you a lot more chance that someone tries to look into this :pray:.

I would expect that `warnings.simplefilter` would work (I am guessing you did the right import to have `ConvergenceWarning` defined although you have not included it), but maybe there are subtleties involved with subprocesses, not sure ...

Labels: Moderate, help wanted
ConvergenceWarnings cannot be turned off

Hi, I'm unable to turn off convergence warnings from `GraphicalLassoCV`.

I've tried most of the solutions from, and none of them worked (see below for actual implementations):
https://stackoverflow.com/questions/879173/how-to-ignore-deprecation-warnings-in-python
https://stackoverflow.com/questions/32612180/eliminating-warnings-from-scikit-learn/33812427#33812427
https://stackoverflow.com/questions/53968004/how-to-silence-all-sklearn-warning
https://stackoverflow.com/questions/14463277/how-to-disable-python-warnings

Contrary to what the designers of the sklearn's exceptions must have thought when it was implemented, some of us actually use stdout to log important information of the host program for diagnostics purposes.  Flooding it with garbage that cannot be turned off, as is in the case with cross-validation, is not ok. 

To briefly speak to the severity of the issue, the above sklearn-specific questions relating to suppressing warnings have been viewed ~500K times with combined ~400 upvotes, and dates back 7 years. 

I've tried the following (`n_jobs` parameter does not appear to affect the result):

```py
from sklearn.covariance import GraphicalLassoCV
import warnings
warnings.filterwarnings("ignore", category=ConvergenceWarning)

model = GraphicalLassoCV(n_jobs=4)
model = model.fit(data)
```

```py
from sklearn.covariance import GraphicalLassoCV
import warnings
warnings.filterwarnings(action='ignore')

model = GraphicalLassoCV(n_jobs=4)
model = model.fit(data)
```

```py
import warnings
with warnings.catch_warnings():
    warnings.simplefilter("ignore", ConvergenceWarning)

    model = GraphicalLassoCV(n_jobs=4)
    model = model.fit(data)
```

```py
from sklearn.covariance import GraphicalLassoCV
def warn(*args, **kwargs):
    pass
import warnings
warnings.warn = warn

model = GraphicalLassoCV(n_jobs=4)
model = model.fit(data)
```

```py
import contextlib
import os, sys

@contextlib.contextmanager
def suppress_stdout():
    with open(os.devnull, 'w') as fnull:
        old_stdout = sys.stdout
        sys.stdout = fnull
        try:
            yield
        finally:
            sys.stdout = old_stdout

with suppress_stdout():
    model = GraphicalLassoCV(n_jobs=4)
    model = model.fit(data)
```

```py
import logging
logging.captureWarnings(True)

logging.getLogger("py.warnings").setLevel(logging.ERROR)

model = GraphicalLassoCV(n_jobs=4)
model = model.fit(data)
```

COMMENT:
In the future we will all use free-threading CPython 3.13 or later and use a threading backend instead of subprocesses :)

Labels: Moderate, help wanted
ConvergenceWarnings cannot be turned off

Hi, I'm unable to turn off convergence warnings from `GraphicalLassoCV`.

I've tried most of the solutions from, and none of them worked (see below for actual implementations):
https://stackoverflow.com/questions/879173/how-to-ignore-deprecation-warnings-in-python
https://stackoverflow.com/questions/32612180/eliminating-warnings-from-scikit-learn/33812427#33812427
https://stackoverflow.com/questions/53968004/how-to-silence-all-sklearn-warning
https://stackoverflow.com/questions/14463277/how-to-disable-python-warnings

Contrary to what the designers of the sklearn's exceptions must have thought when it was implemented, some of us actually use stdout to log important information of the host program for diagnostics purposes.  Flooding it with garbage that cannot be turned off, as is in the case with cross-validation, is not ok. 

To briefly speak to the severity of the issue, the above sklearn-specific questions relating to suppressing warnings have been viewed ~500K times with combined ~400 upvotes, and dates back 7 years. 

I've tried the following (`n_jobs` parameter does not appear to affect the result):

```py
from sklearn.covariance import GraphicalLassoCV
import warnings
warnings.filterwarnings("ignore", category=ConvergenceWarning)

model = GraphicalLassoCV(n_jobs=4)
model = model.fit(data)
```

```py
from sklearn.covariance import GraphicalLassoCV
import warnings
warnings.filterwarnings(action='ignore')

model = GraphicalLassoCV(n_jobs=4)
model = model.fit(data)
```

```py
import warnings
with warnings.catch_warnings():
    warnings.simplefilter("ignore", ConvergenceWarning)

    model = GraphicalLassoCV(n_jobs=4)
    model = model.fit(data)
```

```py
from sklearn.covariance import GraphicalLassoCV
def warn(*args, **kwargs):
    pass
import warnings
warnings.warn = warn

model = GraphicalLassoCV(n_jobs=4)
model = model.fit(data)
```

```py
import contextlib
import os, sys

@contextlib.contextmanager
def suppress_stdout():
    with open(os.devnull, 'w') as fnull:
        old_stdout = sys.stdout
        sys.stdout = fnull
        try:
            yield
        finally:
            sys.stdout = old_stdout

with suppress_stdout():
    model = GraphicalLassoCV(n_jobs=4)
    model = model.fit(data)
```

```py
import logging
logging.captureWarnings(True)

logging.getLogger("py.warnings").setLevel(logging.ERROR)

model = GraphicalLassoCV(n_jobs=4)
model = model.fit(data)
```

COMMENT:
> In the future we will all use free-threading CPython 3.13 or later and use a threading backend instead of subprocesses :)

Yeah that's the ideal world future :crossed_fingers: but still some road to get there :wink:

Labels: Moderate, help wanted
ConvergenceWarnings cannot be turned off

Hi, I'm unable to turn off convergence warnings from `GraphicalLassoCV`.

I've tried most of the solutions from, and none of them worked (see below for actual implementations):
https://stackoverflow.com/questions/879173/how-to-ignore-deprecation-warnings-in-python
https://stackoverflow.com/questions/32612180/eliminating-warnings-from-scikit-learn/33812427#33812427
https://stackoverflow.com/questions/53968004/how-to-silence-all-sklearn-warning
https://stackoverflow.com/questions/14463277/how-to-disable-python-warnings

Contrary to what the designers of the sklearn's exceptions must have thought when it was implemented, some of us actually use stdout to log important information of the host program for diagnostics purposes.  Flooding it with garbage that cannot be turned off, as is in the case with cross-validation, is not ok. 

To briefly speak to the severity of the issue, the above sklearn-specific questions relating to suppressing warnings have been viewed ~500K times with combined ~400 upvotes, and dates back 7 years. 

I've tried the following (`n_jobs` parameter does not appear to affect the result):

```py
from sklearn.covariance import GraphicalLassoCV
import warnings
warnings.filterwarnings("ignore", category=ConvergenceWarning)

model = GraphicalLassoCV(n_jobs=4)
model = model.fit(data)
```

```py
from sklearn.covariance import GraphicalLassoCV
import warnings
warnings.filterwarnings(action='ignore')

model = GraphicalLassoCV(n_jobs=4)
model = model.fit(data)
```

```py
import warnings
with warnings.catch_warnings():
    warnings.simplefilter("ignore", ConvergenceWarning)

    model = GraphicalLassoCV(n_jobs=4)
    model = model.fit(data)
```

```py
from sklearn.covariance import GraphicalLassoCV
def warn(*args, **kwargs):
    pass
import warnings
warnings.warn = warn

model = GraphicalLassoCV(n_jobs=4)
model = model.fit(data)
```

```py
import contextlib
import os, sys

@contextlib.contextmanager
def suppress_stdout():
    with open(os.devnull, 'w') as fnull:
        old_stdout = sys.stdout
        sys.stdout = fnull
        try:
            yield
        finally:
            sys.stdout = old_stdout

with suppress_stdout():
    model = GraphicalLassoCV(n_jobs=4)
    model = model.fit(data)
```

```py
import logging
logging.captureWarnings(True)

logging.getLogger("py.warnings").setLevel(logging.ERROR)

model = GraphicalLassoCV(n_jobs=4)
model = model.fit(data)
```

COMMENT:
We could add an option to disable convergence warnings (or warning of a given category) in the global config and define our own `warn` function that would check the global config to trigger or not the warning. It should work in all settings since the global config is now propagated to sub-processes.

Labels: Moderate, help wanted
ConvergenceWarnings cannot be turned off

Hi, I'm unable to turn off convergence warnings from `GraphicalLassoCV`.

I've tried most of the solutions from, and none of them worked (see below for actual implementations):
https://stackoverflow.com/questions/879173/how-to-ignore-deprecation-warnings-in-python
https://stackoverflow.com/questions/32612180/eliminating-warnings-from-scikit-learn/33812427#33812427
https://stackoverflow.com/questions/53968004/how-to-silence-all-sklearn-warning
https://stackoverflow.com/questions/14463277/how-to-disable-python-warnings

Contrary to what the designers of the sklearn's exceptions must have thought when it was implemented, some of us actually use stdout to log important information of the host program for diagnostics purposes.  Flooding it with garbage that cannot be turned off, as is in the case with cross-validation, is not ok. 

To briefly speak to the severity of the issue, the above sklearn-specific questions relating to suppressing warnings have been viewed ~500K times with combined ~400 upvotes, and dates back 7 years. 

I've tried the following (`n_jobs` parameter does not appear to affect the result):

```py
from sklearn.covariance import GraphicalLassoCV
import warnings
warnings.filterwarnings("ignore", category=ConvergenceWarning)

model = GraphicalLassoCV(n_jobs=4)
model = model.fit(data)
```

```py
from sklearn.covariance import GraphicalLassoCV
import warnings
warnings.filterwarnings(action='ignore')

model = GraphicalLassoCV(n_jobs=4)
model = model.fit(data)
```

```py
import warnings
with warnings.catch_warnings():
    warnings.simplefilter("ignore", ConvergenceWarning)

    model = GraphicalLassoCV(n_jobs=4)
    model = model.fit(data)
```

```py
from sklearn.covariance import GraphicalLassoCV
def warn(*args, **kwargs):
    pass
import warnings
warnings.warn = warn

model = GraphicalLassoCV(n_jobs=4)
model = model.fit(data)
```

```py
import contextlib
import os, sys

@contextlib.contextmanager
def suppress_stdout():
    with open(os.devnull, 'w') as fnull:
        old_stdout = sys.stdout
        sys.stdout = fnull
        try:
            yield
        finally:
            sys.stdout = old_stdout

with suppress_stdout():
    model = GraphicalLassoCV(n_jobs=4)
    model = model.fit(data)
```

```py
import logging
logging.captureWarnings(True)

logging.getLogger("py.warnings").setLevel(logging.ERROR)

model = GraphicalLassoCV(n_jobs=4)
model = model.fit(data)
```

COMMENT:
> An alternative may actually be to use our already existing joblib wrappers like delayed to apply the warning filters to subprocesses, not sure how doable this is and that would be scikit-learn specific.

I think this might be a better option, no? This would fix the problem for any kind of warnings and not just convergence warnings.

Alternatively, we could make joblib itself do this automatically, but I am a bit worried about the extra complexity and potential overhead.

Labels: Moderate, help wanted
ConvergenceWarnings cannot be turned off

Hi, I'm unable to turn off convergence warnings from `GraphicalLassoCV`.

I've tried most of the solutions from, and none of them worked (see below for actual implementations):
https://stackoverflow.com/questions/879173/how-to-ignore-deprecation-warnings-in-python
https://stackoverflow.com/questions/32612180/eliminating-warnings-from-scikit-learn/33812427#33812427
https://stackoverflow.com/questions/53968004/how-to-silence-all-sklearn-warning
https://stackoverflow.com/questions/14463277/how-to-disable-python-warnings

Contrary to what the designers of the sklearn's exceptions must have thought when it was implemented, some of us actually use stdout to log important information of the host program for diagnostics purposes.  Flooding it with garbage that cannot be turned off, as is in the case with cross-validation, is not ok. 

To briefly speak to the severity of the issue, the above sklearn-specific questions relating to suppressing warnings have been viewed ~500K times with combined ~400 upvotes, and dates back 7 years. 

I've tried the following (`n_jobs` parameter does not appear to affect the result):

```py
from sklearn.covariance import GraphicalLassoCV
import warnings
warnings.filterwarnings("ignore", category=ConvergenceWarning)

model = GraphicalLassoCV(n_jobs=4)
model = model.fit(data)
```

```py
from sklearn.covariance import GraphicalLassoCV
import warnings
warnings.filterwarnings(action='ignore')

model = GraphicalLassoCV(n_jobs=4)
model = model.fit(data)
```

```py
import warnings
with warnings.catch_warnings():
    warnings.simplefilter("ignore", ConvergenceWarning)

    model = GraphicalLassoCV(n_jobs=4)
    model = model.fit(data)
```

```py
from sklearn.covariance import GraphicalLassoCV
def warn(*args, **kwargs):
    pass
import warnings
warnings.warn = warn

model = GraphicalLassoCV(n_jobs=4)
model = model.fit(data)
```

```py
import contextlib
import os, sys

@contextlib.contextmanager
def suppress_stdout():
    with open(os.devnull, 'w') as fnull:
        old_stdout = sys.stdout
        sys.stdout = fnull
        try:
            yield
        finally:
            sys.stdout = old_stdout

with suppress_stdout():
    model = GraphicalLassoCV(n_jobs=4)
    model = model.fit(data)
```

```py
import logging
logging.captureWarnings(True)

logging.getLogger("py.warnings").setLevel(logging.ERROR)

model = GraphicalLassoCV(n_jobs=4)
model = model.fit(data)
```

COMMENT:
I see! Thank you @lesteve for the explanation and the work around!

Labels: Moderate, help wanted
Nightly wheel upload has been broken for 11 days

https://anaconda.org/scientific-python-nightly-wheels/scikit-learn/files

![image](https://github.com/scikit-learn/scikit-learn/assets/1680079/4b363524-cd13-4f12-8090-5024fad2f2a7)

Maybe the v3 -> v4 artifact update oh well :sweat: https://github.com/scikit-learn/scikit-learn/pull/29211

[build log](https://github.com/scikit-learn/scikit-learn/actions/runs/9558632617/job/26348276283)

```
+ anaconda -t *** upload --force -u scientific-python-nightly-wheels 'dist/artifact/*'
Using Anaconda API: https://api.anaconda.org/
Using "scientific-python-nightly-wheels" as upload username
Error:  File "dist/artifact/*" does not exist
Error:  File "dist/artifact/*" does not exist
Error: Process completed with exit code 1.
```

COMMENT:
Finally after dealing with quite a few CI quirks here they are: https://anaconda.org/scientific-python-nightly-wheels/scikit-learn/files

Labels: Bug, Build / CI
Add Python 3.13 development wheel

### Describe the workflow you want to enable

Based on #29280, building sklearn on Python 3.13 succeeds and running pytest also succeeds. I want to help enable building and uploading wheels supporting 3.13 on PyPI

### Describe your proposed solution

Since I'm very new in looking at CI files for this project, find someone willing to explain how wheel-building is triggered on GH.

### Describe alternatives you've considered, if relevant

_No response_

### Additional context

_No response_

COMMENT:
Thanks for the issue and your help proposal, This was something I was wondering about whether we want to do it.

Can you say a few words about your use case out of interest, e.g. which kind of projects are you looking to test for, what kind of OS you are targeting, etc ...

I think Numpy already has a Python 3.13 wheel, so we would first need Scipy to have a scipy 3.13 wheel. Last time I checked they don't have a one, see https://anaconda.org/scientific-python-nightly-wheels/scipy/files. Maybe look in Scipy issue tracker if they have already an issue about this? Note that `cp313-cp313t` are actually Python 3.13 free-threaded wheels, if you want standard Python you want `cp313-cp313`.

Side-comment we should have soonish (~one hour) Python 3.13 free-threaded wheel, if https://github.com/scikit-learn/scikit-learn/actions/runs/9575818682 is successful :crossed_fingers: since I merged #29247.

If you are really feeling adventurous and want to test Python 3.13 as fast as possible you can already set-up your testing using Python 3.13 free-threaded and set `PYTHON_GIL=1`. Note that you may bump into weird unexpected issues that are only present in Python 3.13 free-threaded and not Python 3.13 vanilla Python.

Labels: Build / CI
Add Python 3.13 development wheel

### Describe the workflow you want to enable

Based on #29280, building sklearn on Python 3.13 succeeds and running pytest also succeeds. I want to help enable building and uploading wheels supporting 3.13 on PyPI

### Describe your proposed solution

Since I'm very new in looking at CI files for this project, find someone willing to explain how wheel-building is triggered on GH.

### Describe alternatives you've considered, if relevant

_No response_

### Additional context

_No response_

COMMENT:
> [gh-21000](https://github.com/scipy/scipy/pull/21000) added 3.13 wheels builds; new nightlies are building now and should upload to https://anaconda.org/scientific-python-nightly-wheels/scipy/ in the next 30 minutes or so.

Labels: Build / CI