uv: Too long cache filenames
Sorry - pressed enter too fast.
Some combinations of platform / packages might generate too long cache file names. Tested with 0.1.18 on my mint Linux
(reproducible with main airflow`).
[jarek:~/code/airflow]└2 [apache-airflow] main(+4/-4)+ 8s ± uv pip install --upgrade --editable '.[devel-ci]'
Built file:///home/jarek/code/airflow Built 1 editable in 5.20s
error: Failed to download: sqlalchemy==1.4.52
Caused by: Failed to write to the client cache
Caused by: Failed to persist temporary file to /home/jarek/.cache/uv/wheels-v0/pypi/sqlalchemy/sqlalchemy-1.4.52-cp38-cp38-manylinux1_x86_64.manylinux2010_x86_64.manylinux_2_12_x86_64.manylinux_2_5_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.msgpack: File name too long (os error 36)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 9
- Comments: 26 (13 by maintainers)
Commits related to this issue
- Use hash instead of full wheel name in wheels bucket (#11738) <!-- Thank you for contributing to uv! To help us out with reviewing, please consider the following: - Does this pull request include a ... — committed to astral-sh/uv by nkitsaini 2 years ago
- Use hash instead of full wheel name in wheels bucket (#11738) <!-- Thank you for contributing to uv! To help us out with reviewing, please consider the following: - Does this pull request include a ... — committed to loic-lescoat/uv by nkitsaini 2 years ago
Yep. My homedir where I hit it (my linux workstation with Debian Mint) is indeed encrypted. And the reason it is 143 (seems) is explained here https://wiki.archlinux.org/title/ECryptfs#Deficiencies
As of newer version of pip (v23.3+)
pipstores hashed names in the cache - avoiding the problem altogether:It seems like 255 is the common limit on Linux, but that it can be as low as 144 if you have encryption enabled: https://stackoverflow.com/questions/6114301/git-checkout-index-unable-to-create-file-file-name-too-long/6114588#6114588
I don’t have much idea of changes required right now, but I am planning to start working on the implementation.
I am planning to use msgpack file for storing tags, maybe the full filename itself.
I am currently going with
{trimmed_filename}-{hash}for filename, this should be an easy change if we decide to go ahead with pure hash or something else.~I have not yet decided on the migration strategy yet. I will see how big is the implementation difference between incremental vs once for all.~ Found out that uv already has a cache versioning system, so I will use that itself. No migration (yay!).
FYI. We’ve switched Airflow (and I also did it) to use
uvfor recommended workflows and while I have been using uv heavily for syncing and installing things on the regular, encrypted volume I had, I stopped seeing the issue in recent uv version and airflow development environments.I have also not heard anyone else having similar issue.
Not sure what caused it though. W have not changed our requirements for sqlalchemy, but maybe either the algorithm that decides which packages to install or other “generic” error handling in
uvmade the error disappear.From my perspective - this issue can be closed, I think I’d have seen it again with the heavy usage of
uvfor a number of cases and switching to older versions of airflow for backporting if it was still a problem. It used to occur every time when I reported it.Yeah we def need to fix this.
Hello @charliermarsh @zanieb - would it be possible to prioritise that one a bit now?
To add a bit of context - we are now discussing Airlfow 3 approach of managing our complex dependencies and providers, and one of the options considered is to use
uv workspacefeature for that (as discussed before - I looked at it recently and I think it has all we need now, and I will make a POC to show to other PMC members and development community how uv workspaces might be useful to simplify and standardise our setup for providers.Now - this one makes my life really hard … Either I have to remove cache or move the cache somewhere aside of my home directory to another filesystem (but then hard-links don’t work) etc. etc. Also for me - this is quite a blocker to propose it - with our number of contributors (we just passed 3000!) - surely there will be some like me who have they home dir encrypted - especially that it’s an option in multiple distros that you can select (For me - that came out-of-the box with my Linux mint installation and as a security freak I obviously enabled it).
Maybe a good solution will be to check if the filesystem is encrypted or simply react to “too long filename” and use a hash instead - there is no need to change it in bulk - simply handling the exception when it occurs should be good-enough and have very little effect on debuggability.
Looking forward to having this one solved (I’d do it myself - but I have far too many things on my plate now to learn rust and all the internals of
uv.@potiuk Did you manage to use sqlalchemy with uv? I just tried
uvwith our codebase and it failed on the same package 😕edit: caption obvious:
uv pip compile ... --no-cacheworks around this issueFor windows, there might be another solution, I just came across this https://github.com/BurntSushi/ripgrep/blob/master/pkg/windows/README.md, which talks about using a manifest to declare that the application works with paths longer than 260 characters (I suppose the OS libraries change their behaviour then).
This can be a real pain, on my machine the uv default cache dir is:
C:\Users\DMpassy\AppData\Local\uv\cache\already 40 chars If we take, for instance, DjangoRestFramework, a super popular django libC:\Users\DMpassy\AppData\Local\uv\cache\wheels-v0\index\d92ad663158e5f0f\djangorestframework\djangorestframework-3.10.3-py3-none-any\rest_framework\templates\rest_framework\vertical\checkbox_multiple.html206 chars, not that far off from windows 260 upper limit.I’m currently struggling to use UV on CI with jenkins due to that:
I’m not sure how it got that long, I imagine it has to do with uv caching + setuptools building.
Not trivial right now because we read the tags from the wheel name in the built wheel cache
Suggestion: Only use hash if you’ve hit too long name issue.
Certainly: https://pypi.org/project/SQLAlchemy/1.4.52/#files
I think best if you trim+ add hash if the file name exceeds a certain length. That would be probably best solution (it would be a pity to loose the name from cache and replace it with a meaningless hash - though many similar solutions do it exactly this way.