Pytorch forecasting CPUDispatcher error

nxag: <p>Hi guys,<br>
I need help!</p>
<p>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:</p>
<p><strong>SystemError: CPUDispatcher(&lt;function _find_end_indices at 0x0000012AD9E7FAF8&gt;) returned a result with an error set</strong></p>
<p>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.</p>
<p>Any idea of why pytorch forecasting is triggering that error for me ?</p>
<p>Thanks!</p>
<p>Below is full error, as well as the simple generic code that still does not work:</p>
<p><strong>full error</strong></p>
<p>File “…\anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py”, line 827, in runfile<br>
execfile(filename, namespace)</p>
<p>File “…\anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py”, line 110, in execfile<br>
exec(compile(f.read(), filename, ‘exec’), namespace)</p>
<p>File “generictest.py”, line 32, in <br>
time_varying_unknown_reals=[“value”],</p>
<p>File “…\anaconda3\lib\site-packages\pytorch_forecasting\data\timeseries.py”, line 439, in <strong>init</strong><br>
self.index = self._construct_index(data, predict_mode=predict_mode)</p>
<p>File “…\anaconda3\lib\site-packages\pytorch_forecasting\data\timeseries.py”, line 1200, in _construct_index<br>
min_length=min_sequence_length,</p>
<p>SystemError: CPUDispatcher(&lt;function _find_end_indices at 0x0000012AD9E7FAF8&gt;) returned a result with an error set</p>
<p><strong>generic code:</strong><br>
import numpy as np<br>
import pandas as pd</p>
<p>test_data = pd.DataFrame(<br>
dict(<br>
value=np.random.rand(30) - 0.5,<br>
group=np.repeat(np.arange(3), 10),<br>
time_idx=np.tile(np.arange(10), 3),<br>
)<br>
)<br>
test_data</p>
<p>from pytorch_forecasting import TimeSeriesDataSet</p>
<p>dataset = TimeSeriesDataSet(<br>
test_data,<br>
group_ids=[“group”],<br>
target=“value”,<br>
time_idx=“time_idx”,<br>
min_encoder_length=5,<br>
max_encoder_length=5,<br>
min_prediction_length=2,<br>
max_prediction_length=2,<br>
time_varying_unknown_reals=[“value”],<br>
)</p>

nxag: <p>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.</p>
<p>Still not sure on how to resolve this without admin rights but hope that helps anybody looking this up.</p>

ptrblck: <p>Maybe you are hitting the same error as described <a href="https://github.com/jdb78/pytorch-forecasting/issues/633#issuecomment-893126571">here</a> in the repository.<br>
Could you check if using the mentioned <code>numpy</code> and <code>pandas</code> versions would work?</p>

nxag: <p>I guess I do owe some apologies to my admin after all <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=12" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"> , you are right it has to do with pandas and numpy versions.</p>
<p>Note: you do need a version &gt;= pandas 1.3.0 for pytorch-forecasting to work.</p>
<p>I ended up settling for pandas 1.3.1 and numpy 1.19.3</p>
<p>thanks for your help!</p>