I am have deployed the flyte demo cluster, I want ...
# ask-ai
r
I am have deployed the flyte demo cluster, I want to test a simple program that I want to run on the demo cluster. This program needs to be using a simple image that contains pandas library installed. The Dockerfile is: FROM python:3.10-slim-buster WORKDIR /app RUN pip install pandas flytekit COPY . /app I am building and registering successfuly the image on the docker hub. However, when I execute the following execution, I get the error that "Failed with Unknown Exception <class 'ModuleNotFoundError'> Reason: No module named 'pandas'". Let me note that it is looking for pandas in my local environment. It acts as if it is not using my image 'my_image:latest'.
> pyflyte register --image my_user/my_image:latest --project flytesnacks_v3 --domain development --version 1 workflows
What am I doing wrong?
a
You need to ensure that the custom Docker image is correctly specified and used during the execution. Use the
--image
flag with the
pyflyte run
command to specify your custom image. Additionally, ensure that the
PYTHONPATH
is set correctly within the image.
Copy code
import flytekit
from flytekit import task, workflow

@task(container_image="my_user/my_image:latest")
def my_task() -> str:
    import pandas as pd
    return pd.__version__

@workflow
def my_wf() -> str:
    return my_task()

if __name__ == "__main__":
    my_wf()
Run the workflow with:
Copy code
pyflyte run --remote --image my_user/my_image:latest workflows/my_wf.py my_wf
Would you like more detail? Sources: - Couple of problems I ran into while I try to go through - Hi, I'm facing one doubt related to flyte - Hello All, I am trying to install custom packages into the flyte container 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.
r
@ancient-wolf-19325 how can I make sure that "Additionally, ensure that the
PYTHONPATH
is set correctly within the image."?