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

PDM Builds up a huge cache over time #1301

Closed
1 task done
jayceslesar opened this issue Aug 3, 2022 · 15 comments
Closed
1 task done

PDM Builds up a huge cache over time #1301

jayceslesar opened this issue Aug 3, 2022 · 15 comments
Labels
🐛 bug Something isn't working

Comments

@jayceslesar
Copy link

  • I have searched the issue tracker and believe that this is not a duplicate.
pi@raspberrypi:~$ sudo du -xh / | grep -P "G\t"
1.2G	/home/pi/.cache/pdm/http
1.2G	/home/pi/.cache/pdm
1.9G	/home/pi/.cache
3.6G	/home/pi
3.6G	/home
1.3G	/usr
5.1G	/

Not sure how I can better support but this is over the course of several months. Wondering why it doesnt clear itself out?

@jayceslesar jayceslesar added the 🐛 bug Something isn't working label Aug 3, 2022
@jayceslesar
Copy link
Author

Related to #683 ?

@pawamoy
Copy link
Contributor

pawamoy commented Aug 3, 2022

Why would it clear itself? Genuine question.

@jayceslesar
Copy link
Author

Why would it clear itself? Genuine question.

I dont know? Is it normal to build up insanely large caches like this?

@pawamoy
Copy link
Contributor

pawamoy commented Aug 4, 2022

With enough time, you end up installing multiple versions of many libraries, some of which being quite heavy (torch 900MB!, pydantic 30MB, etc). So I understand the size of the cached packages directory.

However I don't know how the http directory works 😄 I think that's just the HTTP responses to packages downloads that are cached.

@frostming
Copy link
Collaborator

I dont know? Is it normal to build up insanely large caches like this?

Why not? Care to look at the size of pip, or yarn, npm if you have installed

@jayceslesar
Copy link
Author

I dont know? Is it normal to build up insanely large caches like this?

Why not? Care to look at the size of pip, or yarn, npm if you have installed

pip cache size shows about 1/4 the size there but I guess that is to be expected if most of my installations are happening through pdm?

@jayceslesar
Copy link
Author

Regardless -- would probably need to collect some better usage stats to compare...

~/Library/Caches
❯ du -sh pip/
1.0G	pip/

~/Library/Caches
❯ du -sh pdm/
2.7G	pdm/

@jayceslesar
Copy link
Author

jayceslesar commented Aug 4, 2022

Unrelated but making a venv from this command seems like a bug?

~/Library/Caches
❯ pdm cache clear
5619 files are removed
python.use_venv is on, creating a virtualenv for this project...
Virtualenv is created successfully at /Users/jslesar/Library/Caches/.venv

@frostming
Copy link
Collaborator

Unrelated but making a venv from this command seems like a bug?

~/Library/Caches
❯ pdm cache clear
5619 files are removed
python.use_venv is on, creating a virtualenv for this project...
Virtualenv is created successfully at /Users/jslesar/Library/Caches/.venv

It may be just you, I can't reproduce, do you have any plugins installed?

@jayceslesar
Copy link
Author

It may be just you, I can't reproduce, do you have any plugins installed?

What plugins do you mean here? I run starship + iterm in zshell

❯ mkdir projects

❯ cd projects

~/projects
❯ ls

~/projects
❯ pdm cache clear
53 files are removed
python.use_venv is on, creating a virtualenv for this project...
Virtualenv is created successfully at /Users/jslesar/projects/.venv

@Hnasar
Copy link
Contributor

Hnasar commented Aug 4, 2022

Regarding the cache: I suppose pypa/pip#3138 and pypa/pipenv#3655 don't clear their cache either.

Regarding creating a virtualenv when it's unnecessary, I think this is a regression with PDM2. I also see on my install (with no plugins) that PDM creates a virtual env any time I clear the cache (I even tried cd /; pdm cache clear)
pdm cache probably doesn't need to create a venv.

@lsmith77
Copy link

we are using platform.sh for hosting and we keep going over the build cache size. would be nice if there would be a way to define the maximum space the cache is allowed to use up and then use an LRU algorithm to clear stuff from the cache.

note I think the situation is particularily problematic since we are downloading spaCy models as dependencies which are several GB in size.

@iacore
Copy link

iacore commented May 19, 2023

Can pdm reuse pip's cache?

@lsmith77
Copy link

lsmith77 commented Oct 24, 2023

note in our case I suspect the issue is caused by downloading spacy model dependencies via download URL

    "en-core-web-lg @ https://github.com/explosion/spacy-models/releases/download/en_core_web_lg-3.6.0/en_core_web_lg-3.6.0-py3-none-any.whl",
    "de-core-news-lg @ https://github.com/explosion/spacy-models/releases/download/de_core_news_lg-3.6.0/de_core_news_lg-3.6.0-py3-none-any.whl",

however so those files should not get cached.

$ pdm config install.cache
False

@frostming
Copy link
Collaborator

$ pdm config install.cache
False

This is not for download cache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants