ICB-DCM / pyPESTO

python Parameter EStimation TOolbox
https://pypesto.readthedocs.io
BSD 3-Clause "New" or "Revised" License
207 stars 45 forks source link

ImportError: cannot import name 'gaussian' from 'scipy.signal' #1354

Closed dweindl closed 3 months ago

dweindl commented 3 months ago

e.g., https://github.com/ICB-DCM/pyPESTO/actions/runs/8534329173:

_________________ ERROR collecting test/sample/test_sample.py __________________
ImportError while importing test module '/home/runner/work/pyPESTO/pyPESTO/test/sample/test_sample.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
test/sample/test_sample.py:17: in <module>
    from pypesto.sample.pymc import PymcSampler
pypesto/sample/pymc.py:7: in <module>
    import arviz as az
.tox/base/lib/python3.9/site-packages/arviz/__init__.py:34: in <module>
    from .plots import *
.tox/base/lib/python3.9/site-packages/arviz/plots/__init__.py:2: in <module>
    from .autocorrplot import plot_autocorr
.tox/base/lib/python3.9/site-packages/arviz/plots/autocorrplot.py:7: in <module>
    from .plot_utils import default_grid, filter_plotters_list, get_plotting_function
.tox/base/lib/python3.9/site-packages/arviz/plots/plot_utils.py:15: in <module>
    from ..stats.density_utils import kde
.tox/base/lib/python3.9/site-packages/arviz/stats/__init__.py:3: in <module>
    from .density_utils import *
.tox/base/lib/python3.9/site-packages/arviz/stats/density_utils.py:8: in <module>
    from scipy.signal import convolve, convolve2d, gaussian  # pylint: disable=no-name-in-module
E   ImportError: cannot import name 'gaussian' from 'scipy.signal' (/home/runner/work/pyPESTO/pyPESTO/.tox/base/lib/python3.9/site-packages/scipy/signal/__init__.py)

Related to the recent scipy release

See also https://github.com/arviz-devs/arviz/issues/2330

Nothing to be fixed in pypesto, but I guess others will run into this issue too...

FFroehlich commented 3 months ago

Nothing to be fixed in pypesto, but I guess others will run into this issue too...

pin scipy until arviz publishes their next release?

dweindl commented 3 months ago

pin scipy until arviz publishes their next release?

Can be done, yes. But I'd only do that for CI jobs then, not in setup.cfg. That latter would be annoying for people who are not even using arviz.

dweindl commented 3 months ago

Nothing to be fixed in pypesto

On second thought: arviz isn't used anywhere in pypesto except for this type annotation?!?

https://github.com/ICB-DCM/pyPESTO/blob/82b7d5da1273b9d442a634e5aabbda9685279d77/pypesto/sample/pymc.py#L118

EDIT: removing it there won't help, since it's still imported via pymc.

dweindl commented 3 months ago

pin scipy until arviz publishes their next release?

1360

Leaving this issue open until there is a new arviz release and 5879755db975a2c9f3ff248da5204f19dbe290d5 can be reverted.

PaulJonasJost commented 3 months ago

Closed with #1376