early-napkin-90297
06/29/2025, 2:36 PMImageSpec.is_container()
and I found this old thread interesting:
https://discuss.flyte.org/t/15616465/hey-guys-how-do-i-add-new-packages-to-the-project-in-flyte-i#01266f7b-9c80-4c3c-907e-2f8e47325480
TL;DR: pyflyte
expects the dependency (cv2
in this case) to be installed locally even though it's guarded by if cv2_image_spec.is_container():
which, in my understanding, should imply that the dependency is only needed at run time in the task pod.
This happens because the ExecutionState.mode
is None
and is_container()
returns True
when running pyflyte run --remote
or pyflyte register
. I've confirmed this behavior with flytekit==1.16.1
. Is this the expected behavior or a bug? If the former, is late import within the task definition the only recourse for this scenario?glamorous-carpet-83516
07/01/2025, 10:49 PMis_container()
returns True locally because you need to import the dependency during local execution, but I think in your case (at registration time), we can make it return False, so you don’t need to import it when registering the workflow.
mind filing an issue, we will fix it.glamorous-carpet-83516
07/01/2025, 10:49 PMelegant-sandwich-48375
07/01/2025, 10:49 PMearly-napkin-90297
07/01/2025, 11:37 PM