pytorch-forecasting icon indicating copy to clipboard operation
pytorch-forecasting copied to clipboard

Import error with latest version of numpy due to the `np.lib.function_base.iterable`

Open shengy90 opened this issue 1 year ago • 0 comments

  • PyTorch-Forecasting version: 1.0.0
  • PyTorch version: 2.3.0
  • Python version: 3.9
  • Operating System: Mac OS Sonoma
  • Numpy version: 2.0.0rc

Expected behavior

from pytorch_forecasting.utils import autocorrelation

Actual behavior

Import error: No module named 'numpy.lib.function_base'

Code to reproduce the problem

from pytorch_forecasting.utils import autocorrelation

I think the issue is from from numpy.lib.function_base import iterable in base_model.py, but function_base is deprecated. You can now import iterable directly in numpy like so: from numpy import iterable.

I'm on Numpy 2.0, but I think this change is already in latest version of numpy 1.26 (https://numpy.org/doc/stable/reference/generated/numpy.iterable.html)

shengy90 avatar May 20 '24 08:05 shengy90