Skip to content

SciPy deprecation of "disp" in optimizer#3581

Merged
skoudoro merged 3 commits intodipy:masterfrom
drammock:scipy-depr
Jun 28, 2025
Merged

SciPy deprecation of "disp" in optimizer#3581
skoudoro merged 3 commits intodipy:masterfrom
drammock:scipy-depr

Conversation

@drammock
Copy link
Copy Markdown
Contributor

we're seeing an MNE-Python CI failure:

DeprecationWarning: scipy.optimize: The disp and iprint options of the L-BFGS-B solver are deprecated and will be removed in SciPy 1.18.0.

It's coming from the init of dipy.core.optimize.Optimizer. Full traceback:

Details
        ../examples/inverse/morph_volume_stc.py failed leaving traceback:
    
        Traceback (most recent call last):
          File "/home/circleci/project/examples/inverse/morph_volume_stc.py", line 86, in <module>
            morph = mne.compute_source_morph(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
          File "<decorator-gen-501>", line 10, in compute_source_morph
          File "/home/circleci/project/mne/morph.py", line 258, in compute_source_morph
            shape, zooms, affine, pre_affine, sdr_morph = _compute_morph_sdr(
                                                          ^^^^^^^^^^^^^^^^^^^
          File "/home/circleci/project/mne/morph.py", line 1159, in _compute_morph_sdr
            ) = _compute_volume_registration(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/home/circleci/project/mne/transforms.py", line 1862, in _compute_volume_registration
            moved_zoomed, reg_affine = affine_registration(
                                       ^^^^^^^^^^^^^^^^^^^^
          File "/home/circleci/python_env/lib/python3.12/site-packages/dipy/testing/decorators.py", line 201, in wrapper
            return convert_positional_to_keyword(func, args, kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/home/circleci/python_env/lib/python3.12/site-packages/dipy/testing/decorators.py", line 192, in convert_positional_to_keyword
            return func(*args, **kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^
          File "/home/circleci/python_env/lib/python3.12/site-packages/dipy/align/_public.py", line 579, in affine_registration
            xform, xopt, fopt = affreg.optimize(
                                ^^^^^^^^^^^^^^^^
          File "/home/circleci/python_env/lib/python3.12/site-packages/dipy/testing/decorators.py", line 201, in wrapper
            return convert_positional_to_keyword(func, args, kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/home/circleci/python_env/lib/python3.12/site-packages/dipy/testing/decorators.py", line 192, in convert_positional_to_keyword
            return func(*args, **kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^
          File "/home/circleci/python_env/lib/python3.12/site-packages/dipy/align/imaffine.py", line 1323, in optimize
            opt = Optimizer(
                  ^^^^^^^^^^
          File "/home/circleci/python_env/lib/python3.12/site-packages/dipy/testing/decorators.py", line 201, in wrapper
            return convert_positional_to_keyword(func, args, kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/home/circleci/python_env/lib/python3.12/site-packages/dipy/testing/decorators.py", line 192, in convert_positional_to_keyword
            return func(*args, **kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^
          File "/home/circleci/python_env/lib/python3.12/site-packages/dipy/core/optimize.py", line 163, in __init__
            res = minimize(
                  ^^^^^^^^^
          File "/home/circleci/python_env/lib/python3.12/site-packages/scipy/optimize/_minimize.py", line 785, in minimize
            res = _minimize_lbfgsb(fun, x0, args, jac, bounds,
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/home/circleci/python_env/lib/python3.12/site-packages/scipy/optimize/_lbfgsb_py.py", line 381, in _minimize_lbfgsb
            warnings.warn("scipy.optimize: The `disp` and `iprint` options of the "
        DeprecationWarning: scipy.optimize: The `disp` and `iprint` options of the L-BFGS-B solver are deprecated and will be removed in SciPy 1.18.0.

This PR is my best guess as to the source of the problem, but I haven't yet looked closely to see if the same thing is happening elsewhere in dipy's codebase. Would be happy if a regular dipy contrib / maintainer took over this PR as it may be a while before I have time to do a thorough job of this.

Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏 Thank you for contributing a pull request !

🚀 We are glad that you are finding DIPY useful !

This is an automatic message. Allow for time for DIPY maintainers to be able to read this pull request and comment on it.

✅ Note that we require the code formatting, testing and documentation builds to pass in order to merge your pull request.

GitHub will report on the status of each aspect as the builds become available. Please, check their status and make the appropriate changes as necessary.

🔍 It is your responsibility to ensure that the above checks pass to have your pull request reviewed in a timely manner and merged.

📖 Please read our CODE OF CONDUCT and our CONTRIBUTING guidelines if you have not done that already.

@skoudoro
Copy link
Copy Markdown
Member

Thank you for this @drammock.

Have these variables been replaced ? or completely removed ? I need to look at this

@drammock
Copy link
Copy Markdown
Contributor Author

Have these variables been replaced ? or completely removed ?

I haven't investigated, so all I know is what the deprecation message said.

@skoudoro
Copy link
Copy Markdown
Member

ok, Thank you for pointing that out, I will look into it 👍

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.86%. Comparing base (7547fe3) to head (92126b1).
Report is 11 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3581      +/-   ##
==========================================
- Coverage   83.87%   83.86%   -0.01%     
==========================================
  Files         161      161              
  Lines       24170    24181      +11     
  Branches     3640     3645       +5     
==========================================
+ Hits        20272    20279       +7     
- Misses       2935     2936       +1     
- Partials      963      966       +3     
Files with missing lines Coverage Δ
dipy/align/imaffine.py 95.79% <100.00%> (ø)
dipy/reconst/qtdmri.py 93.50% <ø> (ø)

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jhlegarreta
Copy link
Copy Markdown
Contributor

Have not investigated the logs, but if any of the builds is using this version of scipy, an error should have been raised.

@skoudoro
Copy link
Copy Markdown
Member

@drammock, Can you remove it here:

disp=False,
also

Then we can go ahead and merge this PR.

@skoudoro
Copy link
Copy Markdown
Member

for backlog, related to scipy/scipy#23186

@drammock
Copy link
Copy Markdown
Contributor Author

@drammock, Can you remove it here:

disp=False,

done

@skoudoro skoudoro added type:maintenance Maintenance tasks, such as release preparation type:backward compatibility Changes to maintain backward-compatibility labels Jun 28, 2025
@skoudoro skoudoro merged commit 984a2bb into dipy:master Jun 28, 2025
5 checks passed
@skoudoro
Copy link
Copy Markdown
Member

Thank you @drammock

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:backward compatibility Changes to maintain backward-compatibility type:maintenance Maintenance tasks, such as release preparation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants