-
Notifications
You must be signed in to change notification settings - Fork 614
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
shared env: executables perms problem on install #5581
Comments
Are the permissions |
The perms of the source file are correct, but |
The file gets moved. We then set the executable bit on it. |
It's intended to be this: https://github.com/pypa/pip/blob/0f21fb920647f07439c3ec9fb29579c0e00072ec/src/pip/_internal/utils/unpacking.py#L88. Perhaps it's wrong as-is. |
Everything works fine for the first user to win the race of being the first to install a new version of a package. The next user installing the same package version into a different conda env fails to install it. |
Perhaps it should first check if this operation is redundant and the right perms have been set already? |
Here is what is happening:
then:
I think that's what's happening with |
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 |
I need to test it out. It's very hard to get right. |
I'm not able to reproduce the hardlinking problem outside of
then:
no |
or perhaps you need to check if you actually need to but from #5581 (comment) we now know that it's not the |
Correct. I see the issue, I believe I can fix it. |
Thank you, Charles if after you merge the fix PR you could give me a wheel I could test with (or I guess I could try to patch 0.2.31) then it'd be easier - because as I said hardlinking is potentially another issue to resolve. |
do you want me to create another issue for:
as I don't see any treatment of hardlinking in the PR you proposed. Or we could work it out one item at a time. Whatever works for you. |
Sure. Any more info you can provide would be great, not sure what's going on there. (It doesn't say "Permission denied" so it may not be a permissions issue.) |
If you want, there are executables available on #5582. |
I confirm that this PR/executable resolves the first issue. I need to figure out next how to reproduce the 2nd one. |
ok, I can reproduce this w/ the binary you shared. Placed it under This works for the first user:
then 2nd user installing into a different conda env:
I can repro this:
|
Why would the hard link already exist though? |
one, sec, I made a mistake. I edited my repro-comment above. |
so it appears that if any parent dir in the link's path is not owned by the user who is trying to hardlink (or perhaps the ownership of the source file?) - it'd fail.
symlinking works fine though:
|
yes, it's the ownership of the source file that matters. The link's path must have the same ownership as the source it seems. I |
why not use
why do you want that the files are linked? it's not like someone is going to edit those files. In fact someone might edit a hardlinked file and it'd impact all conda envs at once - and potentially break other people's envs. I think those should be stand-alone isolated copies. |
@stas00 -- The behavior is configurable. You can set |
That's unfortunate. Will have to revert to the slow |
Sorry that this is frustrating, but we have made some decisions differently from pip for performance and correctness. You can set |
Also as I suggested earlier hardlinking is unsafe in this situation. One user modifying a file in their env will impact all conda envs. If they broke it it'll be broken everywhere else. So I think |
That's very helpful, @zanieb - thank you. I will try that! |
Candidly, you seem to have a fairly bespoke setup — this has never come up in millions upon millions of usages. It doesn’t seem like a lot to ask that you set some global configuration, just as you would for setting up a custom index. Regardless, I’ll probably just make this fallback to copy with a warning like we do for hard linking across drives. |
You can also set UV_LINK_MODE=copy if you want to avoid a configuration file altogether. |
All we want to do is to avoid each user having a copy of Thank you for the I appreciate your amazing support, @charliermarsh and @zanieb and wanting to meet the needs of outliers too. |
@charliermarsh, your suggestion doesn't work:
edit: but it's the copy that fails now - looking at why |
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 #5611 |
@charliermarsh, if I do it manually I get a different error:
Both files are owned by me and they are the same
and the error happens when I try to run as another user. I wonder if it's because of the previously created hardlink - let me delete those first and try again. |
@charliermarsh, I started to get this error with your latest
it then succeeds on the 2nd attempt. It happens 100% of the time. |
Is that a public package? Can I test it somehow? |
It's the package you gave me yesterday. #5581 (comment) |
Sorry, I meant, the package you're installing. |
The culprit is Yes, |
Hmm, ok. Do you see it with the latest uv on PyPI? I've never seen that reported and can't reproduce it on main on macOS:
I can try it in GitHub Actions to see if it reproduces there. |
I will try shortly and report back. |
|
Ah sorry, I meant, if you just |
same issue w/ uv==0.2.31
|
It looks like it ran without error here: #5615 |
You meant this one, right? https://github.com/astral-sh/uv/actions/runs/10167135512/job/28118835463?pr=5615 I was able to overcome this problem by first nuking the cache where that package was residing.
works with |
Everything seems to work now! I repeated the install/uninstall many times by different users - not a hitch! Thank you! |
Great!!! |
As a follow up to #5496 - there is another (new?) perms issue.
There are 2 possibly related issues
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:
Not sure if it copies it from this file?
So that
0666
in this case has to be0777
perhaps for executable files here #5498So currently nobody can use
uv
on our setup because of that.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:I think it's the same problem. But I'm not 100% sure, since this is hardlinking.
@charliermarsh
The text was updated successfully, but these errors were encountered: