PythonOT/POT

[Bug] Linesearch hidden in scipy 1.14

Closed this issue · 1 comments

Describe the bug

Testing with most recent scipy leads to the following error

Run python -m pytest --durations=20 -v test/ ot/ --color=yes --cov=./ --cov-report=xml
ImportError while loading conftest '/home/runner/work/POT/POT/test/conftest.py'.
test/conftest.py:[11](https://github.com/PythonOT/POT/actions/runs/9657485158/job/26636841070?pr=640#step:6:12): in <module>
    from ot.backend import get_backend_list, jax, tf
ot/__init__.py:23: in <module>
    from . import optim
ot/optim.py:22: in <module>
    from scipy.optimize.linesearch import scalar_search_armijo
E   ImportError: cannot import name 'scalar_search_armijo' from 'scipy.optimize.linesearch' (/opt/hostedtoolcache/Python/3.10.[14](https://github.com/PythonOT/POT/actions/runs/9657485158/job/26636841070?pr=640#step:6:15)/x64/lib/python3.10/site-packages/scipy/optimize/linesearch.py)
Error: Process completed with exit code 4.

One needs to import now from teh hiden submodule scipy.optimize._linesearch``

To Reproduce

Steps to reproduce the behavior:

  1. ...

Screenshots

Code sample

Expected behavior

Environment (please complete the following information):

  • OS (e.g. MacOS, Windows, Linux):
  • Python version:
  • How was POT installed (source, pip, conda):
  • Build command you used (if compiling from source):
  • Only for GPU related bugs:
    • CUDA version:
    • GPU models and configuration:
    • Any other relevant information:

Output of the following code snippet:

import platform; print(platform.platform())
import sys; print("Python", sys.version)
import numpy; print("NumPy", numpy.__version__)
import scipy; print("SciPy", scipy.__version__)
import ot; print("POT", ot.__version__)

Additional context

I found that
scipy 13.1 & pot 0.9.3 & numpy=1.26.4 works but scipy 1.14.0 & pot 0.0.3 & numpy 2.0.0 does not work.

After

pip uninstall scipy numpy
pip install scipy==1.13.1 numpy=1.26.4

it worked well.