Repository: Qiskit/qiskit

Issue:
SciPy update causing CI error
### Environment

- **Qiskit Terra version**: 
- **Python version**: 
- **Operating system**: 


### What is happening?

A recent SciPy update is causing this error in CI
```
Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):

      File "/Users/runner/work/1/s/test-job/lib/python3.10/site-packages/ddt.py", line 191, in wrapper
    return func(self, *args, **kwargs)

      File "/Users/runner/work/1/s/test/python/opflow/test_gradients.py", line 684, in test_natural_gradient4
    nat_grad.assign_parameters(value_dict).eval(), correct_values[i], decimal=3

      File "/Users/runner/work/1/s/qiskit/opflow/list_ops/list_op.py", line 460, in eval
    result = self.combo_fn(evals)  # pylint: disable=not-callable

      File "/Users/runner/work/1/s/qiskit/opflow/gradients/natural_gradient.py", line 129, in combo_fn
    return self.nat_grad_combo_fn(x, self.regularization)

      File "/Users/runner/work/1/s/qiskit/opflow/gradients/natural_gradient.py", line 173, in nat_grad_combo_fn
    nat_grad = NaturalGradient._regularized_sle_solver(

      File "/Users/runner/work/1/s/qiskit/opflow/gradients/natural_gradient.py", line 509, in _regularized_sle_solver
    _, x = NaturalGradient._ridge(metric, gradient, lambda1=lambda1)

      File "/Users/runner/work/1/s/qiskit/utils/lazy_tester.py", line 165, in out
    return function(*args, **kwargs)

      File "/Users/runner/work/1/s/qiskit/opflow/gradients/natural_gradient.py", line 392, in _ridge
    lambda_mc, x_mc = NaturalGradient._reg_term_search(

      File "/Users/runner/work/1/s/qiskit/opflow/gradients/natural_gradient.py", line 288, in _reg_term_search
    x_lambda.append(reg_method(metric, gradient, lam))

      File "/Users/runner/work/1/s/qiskit/opflow/gradients/natural_gradient.py", line 389, in reg_method
    reg.fit(a, c)

      File "/Users/runner/work/1/s/test-job/lib/python3.10/site-packages/sklearn/linear_model/_ridge.py", line 1130, in fit
    return super().fit(X, y, sample_weight=sample_weight)

      File "/Users/runner/work/1/s/test-job/lib/python3.10/site-packages/sklearn/linear_model/_ridge.py", line 889, in fit
    self.coef_, self.n_iter_ = _ridge_regression(

      File "/Users/runner/work/1/s/test-job/lib/python3.10/site-packages/sklearn/linear_model/_ridge.py", line 699, in _ridge_regression
    coef = _solve_cholesky(X, y, alpha)

      File "/Users/runner/work/1/s/test-job/lib/python3.10/site-packages/sklearn/linear_model/_ridge.py", line 212, in _solve_cholesky
    return linalg.solve(A, Xy, sym_pos=True, overwrite_a=True).T

      File "/Users/runner/work/1/s/test-job/lib/python3.10/site-packages/scipy/linalg/_basic.py", line 173, in solve
    warn(message, DeprecationWarning, stacklevel=2)

    DeprecationWarning: The 'sym_pos' keyword is deprecated and should be replaced by using 'assume_a = "pos"'. 'sym_pos' will be removed in SciPy 1.11.0.


test.python.opflow.test_gradients.TestGradients.test_natural_gradient4_30___fin_diff____overlap_block_diag____ridge__
```
and 13 other similar failures.

### How can we reproduce the issue?

Run CI Test suite.

### What should happen?

No errors.

### Any suggestions?

Update opflow code for ScyPy changes or suppress deprecation warning.


Discussion:

Resolving patch:
diff --git a/qiskit/algorithms/optimizers/scipy_optimizer.py b/qiskit/algorithms/optimizers/scipy_optimizer.py
--- a/qiskit/algorithms/optimizers/scipy_optimizer.py
+++ b/qiskit/algorithms/optimizers/scipy_optimizer.py
@@ -138,6 +138,13 @@ def minimize(
         if jac is not None and self._method == "l-bfgs-b":
             jac = self._wrap_gradient(jac)
 
+        # Starting in scipy 1.9.0 maxiter is deprecated and maxfun (added in 1.5.0)
+        # should be used instead
+        swapped_deprecated_args = False
+        if self._method == "tnc" and "maxiter" in self._options:
+            swapped_deprecated_args = True
+            self._options["maxfun"] = self._options.pop("maxiter")
+
         raw_result = minimize(
             fun=fun,
             x0=x0,
@@ -147,6 +154,9 @@ def minimize(
             options=self._options,
             **self._kwargs,
         )
+        if swapped_deprecated_args:
+            self._options["maxiter"] = self._options.pop("maxfun")
+
         result = OptimizerResult()
         result.x = raw_result.x
         result.fun = raw_result.fun


Test patch:
diff --git a/qiskit/test/base.py b/qiskit/test/base.py
--- a/qiskit/test/base.py
+++ b/qiskit/test/base.py
@@ -228,6 +228,8 @@ def setUpClass(cls):
             # Internal deprecation warning emitted by jupyter client when
             # calling nbconvert in python 3.10
             r"There is no current event loop",
+            # Caused by internal scikit-learn scipy usage
+            r"The 'sym_pos' keyword is deprecated and should be replaced by using",
         ]
         for msg in allow_DeprecationWarning_message:
             warnings.filterwarnings("default", category=DeprecationWarning, message=msg)