huggingface_hub: Unable to acquire file lock in some situations
Describe the bug
This can cause hangs if Windows doesn’t like the lock_path
(see #35).
If the etag
received contains certain characters ("
, /
), the blob_path
(and in turn the lock_path
) will contain those which causes the file lock to hang.
The problem I encountered with this was solved by sanitizing the etag
passed to the blob_path
here so that it doesn’t contain any characters that aren’t allowed in file names.
Reproduction
No clue, seems to be a very special case.
Logs
No response
System info
- Windows 11
- Python 3.10.11
- main
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 5
- Comments: 16 (5 by maintainers)
Commits related to this issue
- Update huggingface hub to resolve error in windows https://github.com/huggingface/huggingface_hub/issues/1423 — committed to lubobill1990/sd-scripts by lubobill1990 a year ago
A very ugly fix here
Thanks @henk717 @Strahammer @besrabird @BramVanroy for the ping and letting us know. Some models/files were indeed affected since Friday. It has now been fixed server-side so this bug on Windows shouldn’t happen again. As @BramVanroy said, the best way to ensure a future-proof compatibility is to update the client library to
huggingface_hub>=0.15
version which includes a client-side fix. Sorry again for the inconvenience and hope it doesn’t resurface anymore 😃I can also confirm. I tried with the most recent version down to 0.12.1.
EDIT: 0.15.1 does seem to work.
Confirm that the issue has resurfaced. @Wauplin Did something change again server-side?
I tried pull request #1428 and it fixed my problem. Here is how to install it:
pip install git+https://github.com/huggingface/huggingface_hub.git@refs/pull/1428/head
A quick look shows that both #1427 and #1428 do the same thing.
Hi, I spent several hours trying to install InvokeAI and AUTOMATIC1111 WebUI and always got to a point where they just hang forever, and this turned out to be the cause, verified by the fix above. The problem is that no error was printed anywhere, I could only look at the stacktrace after killing the process.
Just adding it for visibility that this affects more than 1 person 😃