When installing torch (or other big package) in python image, we force uv to not use the cache (see https://github.com/InseeFrLab/images-datascience/blob/main/python-pytorch/Dockerfile#L10C33-L10C43). This means users who use uv for their project will have to download those packages again (even if there are already installed in the System python environment).
Moreover, the path of the cache directory in /work means that a lot of space is used for that cache, leading to "No space left" error (just installing torch occupies ~5Gb in cache).
One way to mitigate those issues would be :
- For torch images, remove the
--no-cache flag on uv pip install commands
- Set cache directory for
uv outside of /work
- Set link-mode as
symlink instead of default
This should improve the experience for users using uv and the torch version installed when building the image, without degrading it for others.
One caveat is that the image size will increase significantly (+50%), leading to slower start time.
When installing torch (or other big package) in python image, we force
uvto not use the cache (see https://github.com/InseeFrLab/images-datascience/blob/main/python-pytorch/Dockerfile#L10C33-L10C43). This means users who useuvfor their project will have to download those packages again (even if there are already installed in the System python environment).Moreover, the path of the cache directory in /work means that a lot of space is used for that cache, leading to "No space left" error (just installing torch occupies ~5Gb in cache).
One way to mitigate those issues would be :
--no-cacheflag onuv pip installcommandsuvoutside of/worksymlinkinstead of defaultThis should improve the experience for users using uv and the torch version installed when building the image, without degrading it for others.
One caveat is that the image size will increase significantly (+50%), leading to slower start time.