Statsmodels.api not recognized by Python Script node

Hello. Knime Experts.

I am building a python script that starts with:
import knime.scripting.io as knio
import pandas as pd
import numpy as np
import statsmodels.api as sm

But Knime does not find statsmodels module in the environment:
image

However, statsmodels is installed in Anaconda:
image

And all the other packages in the conda environment (py3_knime) do appear in the environment:

Py3_knime is the Conda environment used by Knime:

Result: error when running script:
Executing the Python script failed: Traceback (most recent call last):
File “”, line 5, in
ModuleNotFoundError: No module named ‘statsmodels’

Can someone point out the simple error I am making?

Thank you!

Bill Bane

Maybe you take a closer look. The screenshot from the environment propagation does look very different from the list above.

You should also check which conda version has been configured under the conda setting in the preferences. Is it possible you have two python versions installed? Maybe check that.

2 Likes

This was very helpful! For my immediate needs, I switched to the Bundled option, which has all that I need for this project, and which works flawlessly. I will make a point of adjusting the Conda environments per your suggested links.

Thank you very much.

Bill

2 Likes

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