# SARIMA Components contain Python errors

**URL:** <https://forum.knime.com/t/sarima-components-contain-python-errors/77098>\
**Category:** KNIME Analytics Platform\
**Tags:** python, bug\
**Created:** [February 7, 2024, 3:51pm UTC](https://forum.knime.com/t/sarima-components-contain-python-errors/77098 "2024-02-07T15:51:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![cbirch](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/c/71c47a/32.png) [@cbirch](https://forum.knime.com/u/cbirch)\
**Post date:** [February 7, 2024, 3:51pm UTC](https://forum.knime.com/t/sarima-components-contain-python-errors/77098/1 "2024-02-07T15:51:49Z")

</div>

It looks like the [SARIMA Learner](https://hub.knime.com/knime/spaces/Examples/00_Components/Time%20Series/SARIMA%20Learner~gVVjDkkaH79V-ju2/current-state) and [SARIMA Predictor](https://hub.knime.com/knime/spaces/Examples/00_Components/Time%20Series/SARIMA%20Predictor~ZQhtGH_fOhzA_49_/most-recent) components were updated in October to go along with the new Python integration. However when you run them out of the box, this error occurs:

```auto
Execute failed: ImportError: cannot import name ‘datetime’ from ‘pandas’

```

It’s easy to fix if you are familiar with Python. I opened the component, opened the dialog for the Python Script ‘SARIMA Learner’ node, and changed this line:

```auto
from pandas import datetime

```

to this:

```auto
import datetime

```

I repeated the process for the SARIMA Predictor component with the Python Script ‘forecast’ node, and now they both run successfully.

This error was already mentioned in [this post](https://forum.knime.com/t/sarima-uploaded-with-errors-on-k-ap-5-1-1-but-on-4-7-7-it-works-why/74850/12) along with some other user issues, but the components have not been updated since. I wanted to flag the bug and post the solution as well for anyone else running into this error.

---

<div class="post-metadata">

**Author:** ![ScottF](https://forum-cdn.knime.com/user_avatar/forum.knime.com/scottf/32/61316_2.png) [@ScottF](https://forum.knime.com/u/ScottF)\
**Post date:** [February 8, 2024, 9:05pm UTC](https://forum.knime.com/t/sarima-components-contain-python-errors/77098/2 "2024-02-08T21:05:51Z")

</div>

Thanks @cbirch for the details. I’ll pass this on internally and see if we can’t get those components fixed.

---

<div class="post-metadata">

**Author:** ![ScottF](https://forum-cdn.knime.com/user_avatar/forum.knime.com/scottf/32/61316_2.png) [@ScottF](https://forum.knime.com/u/ScottF)\
**Post date:** [February 8, 2024, 9:13pm UTC](https://forum.knime.com/t/sarima-components-contain-python-errors/77098/3 "2024-02-08T21:13:17Z")

</div>

It was just pointed out to me that you might want to give the nodes in the [Time Series Python Extension](https://kni.me/e/rxL1wMlNJN-jbnKL) extension a shot 🙂

---

<div class="post-metadata">

**Author:** ![achagnaud](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/a/e56c9b/32.png) [@achagnaud](https://forum.knime.com/u/achagnaud)\
**Post date:** [April 7, 2024, 3:10pm UTC](https://forum.knime.com/t/sarima-components-contain-python-errors/77098/4 "2024-04-07T15:10:13Z")

</div>

Hi guys, is there a way to solve this problem without any Python knowledge. I downloaded the Extension and have Python on bundled. But still have problem with that Error with the ARIMA Nodes.

"ERROR Python Script 3:182:0:368 Execute failed: ImportError: cannot import name ‘datetime’ from ‘pandas’ "

Tanks for your help!  
Anne

---

<div class="post-metadata">

**Author:** ![ScottF](https://forum-cdn.knime.com/user_avatar/forum.knime.com/scottf/32/61316_2.png) [@ScottF](https://forum.knime.com/u/ScottF)\
**Post date:** [April 8, 2024, 2:09pm UTC](https://forum.knime.com/t/sarima-components-contain-python-errors/77098/5 "2024-04-08T14:09:27Z")

</div>

Hi @achagnaud and welcome to the forum.

Just to be clear, did you try the new Python nodes I linked above, or are you still using the verified components?

In either case, are you able to upload a workflow with some sample data that reproduces the problem?

---

<div class="post-metadata">

**Author:** ![achagnaud](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/a/e56c9b/32.png) [@achagnaud](https://forum.knime.com/u/achagnaud)\
**Post date:** [April 8, 2024, 8:30pm UTC](https://forum.knime.com/t/sarima-components-contain-python-errors/77098/6 "2024-04-08T20:30:49Z")

</div>

Hi Scott,  
I have this problem with the regular ARIMA model Leander Node. With the SARIMA it worked without this Error. I just wanted to use the standard Arima Model after the decomposed signal. But if also standard to use the SARIMA I will do so - even though my Signal is Not having a big seasonal effect.

Is it correct that I do not have to but can decompose the Signal anyways before using the SARIMA model? Would be happy to see a video or finding more infos on the SARIMA node - the book of yours is on its way already. But any tutorial would be great!

Thanks for your help and have a great Week.

Anne

---

<div class="post-metadata">

**Author:** ![achagnaud](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/a/e56c9b/32.png) [@achagnaud](https://forum.knime.com/u/achagnaud)\
**Post date:** [April 14, 2024, 8:56pm UTC](https://forum.knime.com/t/sarima-components-contain-python-errors/77098/7 "2024-04-14T20:56:43Z")

</div>

Hi Scott,  
I have tried to use the Workflow on Knime with the updated components and have the same Errors for the SARIMA Learner / Auto-SARIMA / neu Arima Learner.

> **[Time Series Components Updated! – knime](https://hub.knime.com/knime/spaces/Codeless%20Time%20Series%20Analysis%20with%20KNIME/Appendix%20Verified%20Components%20Overview/Time%20Series%20Components%20Updated~h9mtcylrQtz_WD2h/current-state)**
>
> With the new bundled environment included in the Python Scripting (Labs) extension the Time Series nodes are easy than ever to use. All python based TSA compon…

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/f/4/f4fdf26606c01fcf5d6ec2ab2e8aa0afa143773f.png)

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [July 13, 2024, 8:57pm UTC](https://forum.knime.com/t/sarima-components-contain-python-errors/77098/8 "2024-07-13T20:57:31Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
