Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uv falls back to copy instead of symlink #7509

Closed
ypnos opened this issue Sep 18, 2024 · 4 comments
Closed

uv falls back to copy instead of symlink #7509

ypnos opened this issue Sep 18, 2024 · 4 comments
Assignees

Comments

@ypnos
Copy link

ypnos commented Sep 18, 2024

When using a Docker cache mount, as recommended in the documentation, uv falls back to copying instead of hardlinking and complains about it. The message also recommends to suppress the complaint with explicitely setting the link mode to COPY.

See

warn_user_once!("Failed to clone files; falling back to full copy. This may lead to degraded performance.\n If the cache and target directories are on different filesystems, reflinking may not be supported.\n If this is intentional, set `export UV_LINK_MODE=copy` or use `--link-mode=copy` to suppress this warning.");

As a matter of fact, uv now supports link mode "symlink".

  1. It would probably be great to try symlink before falling back to copy
  2. The error message makes it sound like we have to live with the performance degradation, and does not mention that symlink mode is also available
  3. The Docker documentation should include ENV UV_LINK_MODE=symlink so that people do not run into this issue. See https://docs.astral.sh/uv/guides/integration/docker/#caching
@charliermarsh
Copy link
Member

Symlinks are fairly problematic, since if the cache gets deleted, your entire project will break. I generally would not want to default to them.

@zanieb
Copy link
Member

zanieb commented Sep 18, 2024

We set copy in the example at https://github.com/astral-sh/uv-docker-example/blob/3d2a5afd814babec58804b9ffce923ea114a76fb/Dockerfile#L10-L11 — needs to be updated over here.

@notatallshaw
Copy link
Contributor

Symlinks are fairly problematic, since if the cache gets deleted, your entire project will break. I generally would not want to default to them.

I use symlink mode at work and I agree with this, I've hit an issue twice where I had to recreate my entire environment, for me it's worth the trade off but I think a user should know they are opting into symlink.

zanieb added a commit that referenced this issue Sep 19, 2024
@charliermarsh
Copy link
Member

I think this is the correct behavior. It's totally fine for users to use symlinks, but they are also dangerous so I'd prefer not to make them the default.

@charliermarsh charliermarsh self-assigned this Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants