uv: shared env: executables perms problem on install

As a follow up to https://github.com/astral-sh/uv/issues/5496 - there is another (new?) perms issue.

There are 2 possibly related issues

  1. I have upgraded to 0.2.31
$ uv pip install py-spy
Resolved 1 package in 1m 33s
error: Failed to install: py_spy-0.3.14-py2.py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.http.whl (py-spy==0.3.14)
  Caused by: failed to set permissions for file `/env/lib/conda/stas-inference/bin/py-spy`
  Caused by: Operation not permitted (os error 1)

and the file has the correct perms, but is owned by another user in the cache and I think it copied the file from the cache:

-rwxrwxrwx 2 foo foo 9.4M Jul 17 05:13 /env/lib/conda/stas-inference/bin/py-spy

Not sure if it copies it from this file?

-rwxrwxrwx 3 foo foo 9.4M Jul 17 05:13 /env/cache/uv/archive-v0/KXNvF2h2RHusTTHhLSDxY/py_spy-0.3.14.data/scripts/py-spy
*

So that 0666 in this case has to be 0777 perhaps for executable files here https://github.com/astral-sh/uv/pull/5498

So currently nobody can use uv on our setup because of that.

  1. another user reported a similar issue:
error: Failed to install: deepspeed-0.14.4-py3-none-any.whl (deepspeed==0.14.4)
  Caused by: failed to hardlink file from /data/env/cache/uv/archive-v0/v9yFzmI6xnIw5rZHZhlUq/deepspeed-0.14.4.data/scripts/ds_ssh to /env/lib/conda/graphrag_raw/lib/python3.10/site-packages/deepspeed-0.14.4.data/scripts/ds_ssh
  Caused by: Operation not permitted (os error 1)

the source file that the other user is trying to hardlink to via uv pip install deepspeed is owned by me and it has the correct perms:

l /data/env/cache/uv/archive-v0/v9yFzmI6xnIw5rZHZhlUq/deepspeed-0.14.4.data/scripts/ds_ssh
-rwxrwxrwx 2 stas stas 680 Jul 26 23:05 /data/env/cache/uv/archive-v0/v9yFzmI6xnIw5rZHZhlUq/deepspeed-0.14.4.data/scripts/ds_ssh

I think it’s the same problem. But I’m not 100% sure, since this is hardlinking.

@charliermarsh

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 48 (20 by maintainers)

Commits related to this issue

Most upvoted comments

You can also set UV_LINK_MODE=copy if you want to avoid a configuration file altogether.

Great!!!

The shared cache use-case makes sense, I don’t think that’s something we’ve focused on in particular yet — I’m surprised there haven’t been more questions about it. I’ve created another issue to track documenting some recommendations https://github.com/astral-sh/uv/issues/5611

All we want to do is to avoid each user having a copy of uv cache - instead we share it - what’s so special about it? We do the same for conda and pip and many other things - otherwise there will be an insane disk space usage when you multiply each cache by dozens of users.

Thank you for the UV_LINK_MODE=copy suggestion - that would work well. UV_CONFIG_FILE I can easily handle too. I will test it out and let you know if there are still any hiccups remaining.

I appreciate your amazing support, @charliermarsh and @zanieb and wanting to meet the needs of outliers too.

Sorry that this is frustrating, but we have made some decisions differently from pip for performance and correctness.

You can set UV_CONFIG_FILE on your system and place the file wherever you please.

Correct. I see the issue, I believe I can fix it.

I see… So, in your case, only the first install works, since that user owns the file and can change its permissions? But subsequent installs fail, because they can’t change the permissions?

I’ll think on it. We can either make it robust to these kinds of failures, or possibly remove the chmod for files that are copied directly from the cache.