ValueError in PLSRegression.fit() with zero-variance predictor

### Describe the bug

Related: https://github.com/scipy/scipy/commit/5bc3d8814d566ef328f41cfa69ccd797c68b0d02

When fitting a PLSRegression model, if the input array X contains a feature with zero variance (i.e., a constant column), the fit method raises a ValueError: illegal value in 4th argument of internal gesdd.

This results in a division by zero when a predictor has no variance, creating NaN values likely in the intermediate matrices. These NaN values are then passed to the SciPy function, which in turn calls the LAPACK gesdd routine for SVD, causing it to crash.

### Steps/Code to Reproduce

```python
import numpy as np
from sklearn.cross_decomposition import PLSRegression

n_samples = 20
y = np.arange(n_samples, dtype=float)

# This feature has zero variance.
X = np.ones((n_samples, 1))

# This will raise the error.
pls = PLSRegression(n_components=1)
pls.fit(X, y)
```

### Expected Results

The model should either fit successfully (e.g., perhaps assigning a zero weight to the zero-variance feature) or raise a more informative ValueError indicating that a predictor has zero variance.

### Actual Results

We get "ValueError: illegal value in 4th argument of internal gesdd"

```python
/home/user/.local/lib/python3.13/site-packages/sklearn/cross_decomposition/_pls.py:99: RuntimeWarning: invalid value encountered in divide
  y_weights = np.dot(Y.T, x_score) / np.dot(x_score.T, x_score)
/home/user/.local/lib/python3.13/site-packages/sklearn/cross_decomposition/_pls.py:368: RuntimeWarning: invalid value encountered in divide
  x_loadings = np.dot(x_scores, Xk) / np.dot(x_scores, x_scores)
/home/user/.local/lib/python3.13/site-packages/sklearn/cross_decomposition/_pls.py:377: RuntimeWarning: invalid value encountered in divide
  y_loadings = np.dot(x_scores, yk) / np.dot(x_scores, x_scores)
Traceback (most recent call last):
  File "/home/user/agents/test/f.py", line 14, in <module>
    pls.fit(X, y)
    ~~~~~~~^^^^^^
  File "/home/user/.local/lib/python3.13/site-packages/sklearn/cross_decomposition/_pls.py", line 719, in fit
    super().fit(X, y)
    ~~~~~~~~~~~^^^^^^
  File "/home/user/.local/lib/python3.13/site-packages/sklearn/base.py", line 1389, in wrapper
    return fit_method(estimator, *args, **kwargs)
  File "/home/user/.local/lib/python3.13/site-packages/sklearn/cross_decomposition/_pls.py", line 396, in fit
    pinv2(np.dot(self.x_loadings_.T, self.x_weights_), check_finite=False),
    ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.local/lib/python3.13/site-packages/scipy/linalg/_basic.py", line 1607, in pinv
    u, s, vh = _decomp_svd.svd(a, full_matrices=False, check_finite=False)                                                     ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.local/lib/python3.13/site-packages/scipy/linalg/_decomp_svd.py", line 168, in svd               raise ValueError('illegal value in %dth argument of internal gesdd'                                                              % -info)
ValueError: illegal value in 4th argument of internal gesdd
```

### Versions

```shell
System:                                                     python: 3.13.5 (main, Jun 12 2025, 00:00:00) [GCC 14.3.1 20250523 (Red Hat 14.3.1-1)]
executable: /usr/bin/python3                               machine: Linux-6.14.8-400.asahi.fc41.aarch64+16k-aarch64-with-glibc2.40                                                                                              Python dependencies:
      sklearn: 1.6.1
          pip: 25.1.1                                      setuptools: 69.2.0
        numpy: 1.26.4                                           scipy: 1.15.3
       Cython: None                                            pandas: 2.2.3
   matplotlib: 3.10.3
       joblib: 1.5.0                                    threadpoolctl: 3.6.0
                                                        Built with OpenMP: True
threadpoolctl info:                                            user_api: blas
   internal_api: openblas                                   num_threads: 1
         prefix: libopenblas                                   filepath: /usr/lib64/libopenblas-r0.3.26.so
        version: 0.3.26                                 threading_layer: disabled
   architecture: neoversen1
       user_api: openmp                                    internal_api: openmp
    num_threads: 8                                               prefix: libgomp
       filepath: /usr/lib64/libgomp.so.1.0.0                    version: None
                                                               user_api: blas
   internal_api: openblas
    num_threads: 8                                               prefix: libscipy_openblas
       filepath: /home/user/.local/lib/python3.13/site-packages/scipy.libs/libscipy_openblas-9778f98e.so
        version: 0.3.28                                 threading_layer: pthreads
   architecture: neoversen1

       user_api: openmp                                    internal_api: openmp
    num_threads: 8                                               prefix: libgomp
       filepath: /home/user/.local/lib/python3.13/site-packages/scikit_learn.libs/libgomp-d22c30c5.so.1.0.0             version: None
```

COMMENT:
I do not observe a problem on dataset with 2 features only one of which has zero variance:

```python
In [4]: import numpy as np
   ...: from sklearn.cross_decomposition import PLSRegression
   ...: 
   ...: n_samples = 20
   ...: y = np.arange(n_samples, dtype=float)
   ...: 
   ...: # This feature has zero variance.
   ...: X = np.ones((n_samples, 2))
   ...: X[:, 1] = np.random.randn(n_samples)
   ...: 
   ...: # This will raise the error.
   ...: pls = PLSRegression(n_components=1)
   ...: pls.fit(X, y).predict(X)
Out[4]: 
array([11.22269506, 10.26823666,  7.5226081 , 10.07196233,  8.68631069,
        9.65299942,  7.25543421,  9.72292063,  7.2095984 ,  8.86303744,
        9.93645787, 10.02573371,  6.27136844,  8.65330019, 11.58128088,
        9.75955778, 11.30057952,  9.44093588,  9.92956277, 12.62542   ])
```

If the problem only happens when all features have 0 variance, then I think it would be fine to raise a `ValueError` on such degenerate training sets.

On the other hand, if you can reproduce the problem on non-trivial training sets, then maybe it might be interesting to instead trim the zero variance features one way or another so that they do not prevent numerical convergence.

Labels: Bug