<#5597 [Core feature] Allow overriding dependency ...
# flyte-github
a
#5597 [Core feature] Allow overriding dependency versions in ImageSpec Issue created by nightscape ### Motivation: Why do you think this is important? I'm trying to use
flytekitplugins-onnxtensorflow
in a custom image built with `ImageSpec`: custom_image = ImageSpec( registry="localhost:30000", packages=["flytekitplugins-onnxtensorflow"] ) This fails due to a version conflict between
tensorflow-onnx
(which locks `protobuf` to a `3.x` version in order to stay compatible with older Tensorflow versions) and
...
which requires a
protobuf
version
4.x
.
tensorflow-onnx
is actually compatible with newer versions of
protobuf
, it just declares the dependency because older versions of
tensorflow
did not lock the version of
protobuf
themselves. ### Goal: What should the final outcome look like, ideally? For situation such as this, it would be nice to be able to specify dependency version overrides, which uv supports. I would imagine something like this: custom_image = ImageSpec( registry="localhost:30000", packages=["flytekitplugins-onnxtensorflow"], package_version_overrides=["protobuf==4.25.2"] ) ### Describe alternatives you've considered Currently I'm doing a quite ugly workaround like this: custom_image = ImageSpec( registry="localhost:30000", commands=[ """\ --mount=type=cache,sharing=locked,mode=0777,target=/root/.cache/uv,id=uv \ --mount=from=uv,source=/uv,target=/usr/bin/uv \ echo protobuf==4.25.2 > overrides.txt""", "echo tensorflow~=2.15.0 >> overrides.txt", "/usr/bin/uv pip install --python /root/micromamba/envs/dev/bin/python $PIP_EXTRA --override overrides.txt flytekitplugins-onnxtensorflow onnxruntime", ], ) ### Propose: Link/Inline OR Additional context The change should be rather simple: 1. Add a
package_version_override: Optional[List[str]] = None
parameter to
ImageSpec
2. Read this parameter, write the overrides to a
override.txt
file and add an additional
--override override.txt
parameter to the
uv
call iff overrides are defined. ### Are you sure this issue hasn't been raised already? • Yes ### Have you read the Code of Conduct? • Yes flyteorg/flyte