question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

{cache-dir}/virtualenvs may be too volatile a storage location for some users

See original GitHub issue
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Feature Request

Poetry by default saves its virtualenvs in {cache-dir}/virtualenvs which by default is ~/.cache/pypoetry/virtualenvs (Linux) and ~/Library/Caches/pypoetry/virtualenvs (MacOS). However, these folders are generally considered to be safe to be removed: Linux, MacOS

XDG also specifies to use the cache directory for non essential files. (i.e. those that are trivially recreated without user interaction.)

I report this because I emptied the cache on a server and this dropped the in the background running webserver using a poetry virtualenv, unbeknownst to me (luckily it was weekend).

So I recommend to set a different default for the virtualenv folder. If you follow XDG specifications that would probably be ~/.local/share/poetry/virtualenvs (FYI: Pipenv already uses ~/.local/share/virtualenvs), and there is probably an similar folder for MacOS.

(Default virtualenvs folder for Windows should probably be fine.)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:11
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

8reactions
felcianocommented, May 21, 2021

This bug just bit me hard on MacOS. Optimization software like CleanMyMac will clear out ~/Library/Caches/ periodically, wiping out packages downloaded by poetry. They’ve (correctly IMO) pointed to the Apple technical docs that pretty clearly indicate that this directory shouldn’t include any files that applications depend on and can’t recreate themselves (e.g. “the application does not require cache data to operate properly, but it can use cache data to improve performance”).

This seems like a valid and well-documented design decision, and one that poetry should respect out-of-the-box. Since python apps aren’t typically expected to be able to re-install required libraries on their own (!), shouldn’t a different default cache location be used on MacOS?

5reactions
hwalingacommented, Nov 11, 2020

Yes, but I found that out when it already went wrong 😃 (I wouldn’t expect people to completely read the docs, especially for a package manager. So, any rm happy person can make the same mistake as me.)

But it would really be nice to have a more saner default instead. I think ~/.local/share/poetry/virtualenvs would be the perfect location (just as Pipenv does it) and for MacOS that is as it seems ~/Library/Application Support/poetry/virtualenvs or just ~/Library/poetry/virtualenvs

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to locate and change Firefox Cache storage location
(4) Type or paste the new parent folder (Firefox will create its cache2 folder inside this folder) and click the blue checkmark button...
Read more >
[Solved] RAM is a storage location A permanent B peripheral ...
Non-volatile refers to the memory when the value is retained even when the power is off. It has slow access and seems difficult...
Read more >
Where is pip's cache in a virtualenv? - Stack Overflow
According to documentation pip caching. The default location for the cache directory depends on the Operating System.
Read more >
Changing the disk cache directory and agent temporary ...
The same location is used for the disk cache directory and agent temporary storage. You can use one of two methods. Use the...
Read more >
Solved: Setting Flash Player storage location - 3866193
Browsers and flash alike keep the bigger files in a cache directory. That may be in Users\user\appdata\local\temp or in windows\temp or in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found