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 cache prune doesn't remove packages from cache for deleted environments #10153

Closed
neckbosov opened this issue Dec 25, 2024 · 4 comments
Closed
Labels
cache Caching of packages and metadata question Asking for clarification or support

Comments

@neckbosov
Copy link

neckbosov commented Dec 25, 2024

Steps to reproduce:

mkdir $HOME/uv-test && cd $HOME/uv-test
export UV_CACHE_DIR=$HOME/uv-test/uv-cache
uv venv --python 3.9 ./python39env
VIRTUAL_ENV=./python39env uv pip install torch
du -hs ./uv-cache

uv venv --python 3.11 ./python311env
VIRTUAL_ENV=./python311env uv pip install torch
du -hs ./uv-cache

rm -rf ./python39env
uv cache prune
du -hs ./uv-cache

Expected result:
After pruning cache size will be the same as after the first installation.

Actual result:
uv cache prune doesn't delete anything, cache size stays the same as after the second installation.

uv version 0.5.10, fedora linux.

@neckbosov neckbosov changed the title uv cache prune doesn't remove packages from cache for deleted environments uv cache prune doesn't remove packages from cache for deleted environments Dec 26, 2024
@charliermarsh
Copy link
Member

What do you expect to be removed after uv cache prune?

@charliermarsh charliermarsh added question Asking for clarification or support cache Caching of packages and metadata labels Dec 26, 2024
@sh-shahrokhi
Copy link

sh-shahrokhi commented Dec 26, 2024

What do you expect to be removed after uv cache prune?

I have the same question. I thought torch and its dependencies should be removed.

@neckbosov
Copy link
Author

I would expect all packages installed for python 3.9 to be removed because they are no longer used in any of environments.

@charliermarsh
Copy link
Member

Ah, that's not the purpose of uv cache prune. We can't track "which packages are used in which environments". uv cache prune is intended to remove items that are internally unreachable from the cache (e.g., if we built a newer version of a source distribution, we can remove the older versions).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cache Caching of packages and metadata question Asking for clarification or support
Projects
None yet
Development

No branches or pull requests

3 participants