https://flyte.org logo
#ask-the-community
Title
# ask-the-community
m

Magnus

10/31/2023, 5:37 PM
Hello! I'm very new to Flyte, so sorry if this is a very basic question. I have set up flyte locally with a mini-cluster with - flytectl demo start This works well when trying simple flyte runs. However, when I try to use my own custom image, I seem to mess something up. I upload my built image to my local docker registry and then try to run
Copy code
pyflyte run --remote --image localhost:30000/image/test-image:latest test_file.py run_test
Flyte finds the image, but can't find my test_file.py within the image. I get
Copy code
ModuleNotFoundError: No module named 'test_file'
whenever I try to run it. It works without the --image flag, but whenever I try to use my custom image it fails. If I run
Copy code
pyflyte run test_file.py run_test
within the image it works out of the box without needing to modify any envs/change folder. I'm not sure if I missed something or missunderstood how I'm supposed to work with custom images. My custom docker-image in my latest test is just mimicing the behaviour of https://github.com/flyteorg/flytesnacks/blob/master/examples/basics/Dockerfile
d

Dan Farrell

10/31/2023, 6:16 PM
you may need to set PYTHONPATH=/root in your image or follow the following snippet as flyte expects you to be in the /root directory which may be the problem
Copy code
@task(container_image="localhost:30000/esmfold:latest", environment={"PYTHONPATH": "/root"}, requests=Resources(cpu="7", mem="28Gi"))
def run_esmfold(sequences: list[str]) -> list[FlyteFile]:
    ...
m

Magnus

10/31/2023, 9:02 PM
Thanks! Will try that out tomorrow!
y

Yee

11/01/2023, 10:02 AM
let us know if setting the pythonpath doesn’t work magnus.
m

Magnus

11/02/2023, 12:51 PM
It worked, thanks!
With this in mind, does the pods running Flyte tasks need to have root access then within the container? Or can that be avoided somehow?
Nvm my last question, I could just force it to another folder.
y

Yee

11/03/2023, 1:36 AM
the default image doesn’t have root access actually https://github.com/flyteorg/flytekit/blob/master/Dockerfile
2 Views