Module Not Found Error, while running workflows in FlyteConsole #2909
Replies: 3 comments 14 replies
-
@sakthi-tech4th, |
Beta Was this translation helpful? Give feedback.
-
@laruokol, you're trying to use code from a different Python module. How are you importing tasks in the |
Beta Was this translation helpful? Give feedback.
-
Just add ENV PYTHONPATH=/root in your Dockerfile. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I created a simple worflow with one task, that reads a csv file into a pandas dataframe.
My code is something like below.
`
import os
import sys
import pandas as pd
sys.path.append(r'path_to_my_python_modules')
from data.data_ingestion import load_data # data is folder in path_to_my_models, which contains the file data_ingestion.py.
@task
def getdata(data_path: str='', some_int: int=0) -> pd.DataFrame:
df =load_data(data_path=data_path, some_int=some_int)
return df
@workflow
def my_wf(my_path: str='', my_int: int=0) -> pd.DataFrame:
df = getdata(data_path=my_path, some_int=my_int)
return df
if name == "main":
data_root = os.getenv('raw_data_folder')
data_path = os.path.join(data_root, 'my_data.csv')
print(data_path)
some_int= 6
data_df = my_wf(my_path=data_path, my_int=some_int)
print(data_df)
`
When i run the code locally using:
'python my_pipeline.py'
I have no errors, outputs are as expected.
However, when I run pyflyte:
pyflyte run --remote my_pipeline.py my_wf
I get Module Not Found Error.
from data.data_ingestion import load_data
ModuleNotFoundError: No module named 'data'
I believe, I have include my modules in the dockerimage/container where my code is running.
Could you please guide me on how to make my modules available to the workflow?
Beta Was this translation helpful? Give feedback.
All reactions