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.

POETRY_CACHE_DIR or cache-dir config are not used at all.

See original GitHub issue
  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

Issue

Setting the cache-dir location using either the environment variable POETRY_CACHE_DIR or with poetry config cache-dir /path/to/new/cache does not work. Poetry still uses the default location C:\Users\<user>\AppData\Local\pypoetry\Cache.

This will not work for me as there are size constraints on my user profile directory. Beacuse of this I need to relocate this directory to another drive.

I believe this to be cause by the fact that the environment/config settings are never read when determining the cache location.

poetry/utils/appdirs.py

def user_cache_dir(appname):
    r"""
    Return full path to the user-specific cache dir for this application.
        "appname" is the name of application.
    Typical user cache directories are:
        macOS:      ~/Library/Caches/<AppName>
        Unix:       ~/.cache/<AppName> (XDG default)
        Windows:    C:\Users\<username>\AppData\Local\<AppName>\Cache
    On Windows the only suggestion in the MSDN docs is that local settings go
    in the `CSIDL_LOCAL_APPDATA` directory. This is identical to the
    non-roaming app data dir (the default returned by `user_data_dir`). Apps
    typically put cache data somewhere *under* the given dir here. Some
    examples:
        ...\Mozilla\Firefox\Profiles\<ProfileName>\Cache
        ...\Acme\SuperApp\Cache\1.0
    OPINION: This function appends "Cache" to the `CSIDL_LOCAL_APPDATA` value.
    """
    if WINDOWS:
        # Get the base path
        path = os.path.normpath(_get_win_folder("CSIDL_LOCAL_APPDATA"))

        # Add our app name and Cache directory to it
        path = os.path.join(path, appname, "Cache")
    elif sys.platform == "darwin":
        # Get the base path
        path = expanduser("~/Library/Caches")

        # Add our app name to it
        path = os.path.join(path, appname)
    else:
        # Get the base path
        path = os.getenv("XDG_CACHE_HOME", expanduser("~/.cache"))

        # Add our app name to it
        path = os.path.join(path, appname)

    return path

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:13
  • Comments:21 (12 by maintainers)

github_iconTop GitHub Comments

5reactions
adam-grant-hendrycommented, Jun 18, 2022

You may need to set three environment variables to alter poetry’s default directories instead of single POETRY_CACHE_DIR

Oh interesting…

  1. Why is it that I need to set all 3?
  2. Why doesn’t simply using poetry config to set the values and have them stored in the config.toml suffice? Why do I also need to set environment variables?
2reactions
abncommented, May 24, 2022

Resovled by #5672.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuration | Documentation | Poetry - Python dependency ...
Create the virtualenv inside the project's root directory. If not set explicitly, poetry by default will create virtual environment under {cache-dir}/ ...
Read more >
How to cache poetry install for GitHub Actions - Stack Overflow
In your YAML file you are using dschep/install-poetry-action@v1.3 to install Poetry, which sets poetry config virtualenvs.create false ...
Read more >
v0.5.0 - Manim Community
Scenes rendered with the OpenGL renderer must only use OpenGL-enabled Mobjects. Deprecated classes and functions#. #1124: Deprecated ...
Read more >
cache dir | Data Version Control - DVC
cache dir. Set/unset the cachecache directory location intuitively (compared to using dvc config cache ), or shows the current configured value.
Read more >
Configuring Packer - HashiCorp Developer
By default Packer will use known folders, which can be changed by using ... These settings all have reasonable defaults, so you generally...
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