Python Error Help :)

Hello All,

I have been struggled to find out a solution for the error that at the attached file.
Could you please, advise me on how to solve this issue?

Thanks

Hi @mrtcnbsk,

It seems like you are trying to use the statsmodels Python module which does not seem to be installed in the Python environment that you are using with KNIME. You can install it via conda (if you are using a conda environment) or pip. There is a guide on the statsmodels website that explains how to do that.

Marcel

4 Likes

Hi @MarcelW & @mrtcnbsk

Welcome @mrtcnbsk to the KNIME community !

The ‘statsmodels’ Python library seems to be included in the default Python environment (py3_knime) proposed as default when creating a Python KNIME environment. At least, this is what I see on my -Conda Environment Propagation- node configuration menu.

I’m therefore surprised that you get this error. Could you please open the configuration menu of this node and check inside that the ‘statsmodels’ Python library is part of the environment?

image

What you should see is the following:

If this line is present in your environment list of libraries, then make sure too that the following line is present in the Python code you are running:

As you can see here after execution using the button ‘Execute Script’ of the -Python Script- node, the import statsmodels.api as sm was correctly executed.

Otherwise, if this library does not appear in your selected Python environment, you would need to add it to it as suggested by @MarcelW.

Hope this helps.

Best

Ael

3 Likes

Hello Both,

Thanks for your help :slight_smile: I’ve solved that issue and am facing another error now :slight_smile:
very luck ha!

Good news @mrtcnbsk !

This sounds to be a function configuration problem more than a bug. I would say from the error message that if your correlation lag if bigger than half of the size of your data (e.g. # of rows in Table) then the function you are using is not happy :wink:

Most probably your data is only 28 rows big and you are using a nlags parameter of more than the half (24!).

This is just a guess since I’m not a ‘statsmodels’ library user.

Hope it helps.

Best

Ael

2 Likes

Hello Ael,

I have just begun to use Knime, am trying to understand what is it, how can I use it, etc.
This case which is trying to run: 01_Accessing_Transforming_and_Modeling_Time_Series

How have you ever worked on it?

Could you please, share a tutorial for beginners like me?

Thanks,

Hi @mrtcnbsk

No problem at all and happy to help !

I just did a very quick search and found this blog by Mahantesh Pattadka which seems very nice:

Please have a look at it and at the links in it. There are links to KNIME workflow examples based on Python. This should be a starting point.

I’m leaving work now but many other community members will come with extra help for sure.
Otherwise I’ll check tomorrow and continue to help as far as I can :wink:
But already with this link, there is enough material to be busy for a while lol.

Good luck and best wishes!

Ael

2 Likes

Just for the sake of completeness: I don’t think that statsmodels is part of KNIME’s default environment. At least it’s not part of mine (the same is true for seaborn which is also listed in the screenshot) :slight_smile:.

Anyway, glad to hear that this first problem got solved :slight_smile:.

2 Likes

Thanks @MarcelW for the clarification. It appears in mine so this is why I thought it was but it may be that it was added later and I forgot. Yes good @mrtcnbsk got it fixed anyway :wink:

Cheers

Ael

2 Likes