I clearly import statsmodels library both in train and in inference and it runs fine in the notebook but once I submit it, I get this error. Can you please help resolve this issue?
Traceback (most recent call last):
File "/context/venv/lib/python3.10/site-packages/crunch/runner/cloud_executor.py", line 230, in start
prediction = self.process_unstructured()
File "/context/venv/lib/python3.10/site-packages/crunch/runner/cloud_executor.py", line 486, in process_unstructured
return utils.smart_call(
File "/context/venv/lib/python3.10/site-packages/crunch/utils.py", line 270, in smart_call
return function(**arguments)
File "/context/scoring/runner.py", line 78, in train
smart_call(
File "/context/venv/lib/python3.10/site-packages/crunch/utils.py", line 270, in smart_call
return function(**arguments)
File "/context/code/main.py", line 1831, in train
import statsmodels
ModuleNotFoundError: No module named 'statsmodels'
Our system do not detect imports that are in nested scopes, you must declare them at the hightest level.
Don’t do this:
def train():
import statsmodels
...
Prefer this:
import statsmodels
def train():
...