I am trying to run Exercise 3.Time_Seriese_no_flowvars of Chapter 4 of Advanced Luck eBook. I can run all the nodes, including Remove Seasonality, except “Inspect Seasonality”, where I get the following error:
ERROR Python Script (1⇒1) (deprecated) 3:0:0:2 Execute failed: No module named ‘statsmodels’
Traceback (most recent call last):
File “”, line 4, in
ImportError: No module named ‘statsmodels’
I can import statsmodels when I open my Python 3.7 editor (Spyder). I have also installed the batch file py35.bat in my root directory as suggested by one blog:
--------------------py35.bat------------------------------------------------------------------------------------ @REM Adapt the directory in the PATH to your system @SET PATH=C:\Users…\anaconda3\Scripts;%PATH% @CALL activate py35_knime || ECHO Activating py35_knime failed @python %*
Have you configured the KNIME Python integration as described in our documentation? Option 1 is generally the most straightfoward approach: KNIME Python Integration Guide
The reason I ask is because it seems like KNIME doesn’t know where your Anaconda installation is to begin with, and therefore can’t find the statsmodels package. Once you’ve configured a python environment for KNIME to use, and KNIME knows where it is, it’s pretty straightforward to add packages using pip or conda install.
Thank you Scott. I followed the provided instruction to integrate Knime and Python as suggested but I am afraid the node still does not work. I even tried Python 2 as the default version. The same thing. It is very frustrating! As I mentioned I can use statsmodels directly when I use Python.
I have attached a couple of snapshots.
After configuring the new python environment (for example, py3_knime) did you then add the statsmodels package to it using conda install or pip or similar?
Hi Scott,
Yes, statsmodels is installed…I installed it again using: “conda install -c conda-forge statsmodels” to make sure.
But it does not show it in the installed packages for py3_knime. Do I have to add it to this specific python environment (py3_knime)? If yes, how?
I think you either need to manually activate the py3_knime environment first to make sure you’re installing into the correct enviroment (activate py3_knime), or use conda install with the -n option to manually select the enviroment (conda install -n py3_knime -c conda-forge statsmodels).
My best guess is that you’re installing statsmodels into your default environment, whatever that happens to be.
Hi Scott,
That was it! I needed to install statsmodels in py3_knime environment as you suggested by using: conda install -n py3_knime -c conda-forge statsmodels.
May I suggest to update the Knime Python Integration Guide accordingly? I suspect many casual programmers like me might have faced the same issue. There is also a circular logic in the active links in the guide. I will be more than happy to point it out to you if you are able to make changes. You may reach out to me directly if you can access my email address.
Thank you so much again!