When a Python Script/Commands task declares dependencies and runs on a remote task runner (e.g. Kubernetes), the script fails with ModuleNotFoundError.
The resolved packages are installed under the working dir (.kestra_additional_python_lib) and exposed via PYTHONPATH, but PYTHONPATH is set to the absolute worker path (e.g. /tmp/<id>/.kestra_additional_python_lib) instead of being remapped to the runner working dir (e.g. /kestra/working-dir/...). With the Docker runner the worker working dir is mounted at the same path so it worked; the Kubernetes runner mounts it at /kestra/working-dir, so the path doesn't exist in the pod.
Affects python.Script and python.Commands.
When a Python
Script/Commandstask declaresdependenciesand runs on a remote task runner (e.g. Kubernetes), the script fails withModuleNotFoundError.The resolved packages are installed under the working dir (
.kestra_additional_python_lib) and exposed viaPYTHONPATH, butPYTHONPATHis set to the absolute worker path (e.g./tmp/<id>/.kestra_additional_python_lib) instead of being remapped to the runner working dir (e.g./kestra/working-dir/...). With the Docker runner the worker working dir is mounted at the same path so it worked; the Kubernetes runner mounts it at/kestra/working-dir, so the path doesn't exist in the pod.Affects
python.Scriptandpython.Commands.