Pytorch forecasting CPUDispatcher error

Hi guys,
I need help!

I have been trying to use pytorch_forecasting with a script of mine and I keep getting the same error when calling the TimeSeriesDataSet function from python_forecasting:

SystemError: CPUDispatcher(<function _find_end_indices at 0x0000012AD9E7FAF8>) returned a result with an error set

After spending a while questioning all the ins and outs of my script, I simply used the generic code available online that is supposed to work, and I am still getting the same error.

Any idea of why pytorch forecasting is triggering that error for me ?


Below is full error, as well as the simple generic code that still does not work:

full error

File “…\anaconda3\lib\site-packages\spyder_kernels\customize\”, line 827, in runfile
execfile(filename, namespace)

File “…\anaconda3\lib\site-packages\spyder_kernels\customize\”, line 110, in execfile
exec(compile(, filename, ‘exec’), namespace)

File “”, line 32, in

File “…\anaconda3\lib\site-packages\pytorch_forecasting\data\”, line 439, in init
self.index = self._construct_index(data, predict_mode=predict_mode)

File “…\anaconda3\lib\site-packages\pytorch_forecasting\data\”, line 1200, in _construct_index

SystemError: CPUDispatcher(<function _find_end_indices at 0x0000012AD9E7FAF8>) returned a result with an error set

generic code:
import numpy as np
import pandas as pd

test_data = pd.DataFrame(
value=np.random.rand(30) - 0.5,
group=np.repeat(np.arange(3), 10),
time_idx=np.tile(np.arange(10), 3),

from pytorch_forecasting import TimeSeriesDataSet

dataset = TimeSeriesDataSet(

In case that helps, I have tried on a different machine and the error is not being raised. It seems to me that this has to do with some restrictions done by the admin of the machine.

Still not sure on how to resolve this without admin rights but hope that helps anybody looking this up.

Maybe you are hitting the same error as described here in the repository.
Could you check if using the mentioned numpy and pandas versions would work?

I guess I do owe some apologies to my admin after all :slight_smile: , you are right it has to do with pandas and numpy versions.

Note: you do need a version >= pandas 1.3.0 for pytorch-forecasting to work.

I ended up settling for pandas 1.3.1 and numpy 1.19.3

thanks for your help!