FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[ENH]: move .matplotlib folder from %USERPROFILE% on Windows · Issue #20779 · matplotlib/matplotlib · GitHub

Repository navigation

[ENH]: move .matplotlib folder from %USERPROFILE% on Windows #20779

Closed

Description

Problem

The folder contains "fontlist-v330.json" in my case.

Proposed solution

Move the directory to a subdirectory in %APPDATA%, where it belongs (as the name suggests).

Additional context and prior art

No response

Activity

  1. tacaswell commented on Aug 2, 2021

    Member

    Do you have a reference for what "should" be in various places?

    I suspect that this would be addressed by #12549 , but if we do not want to pick up that dependency, the place in the code to make the change is

    else:
    configdir = Path.home() / ".matplotlib"
    try:
    configdir.mkdir(parents=True, exist_ok=True)
    except OSError:
    pass
    else:
    if os.access(str(configdir), os.W_OK) and configdir.is_dir():
    return str(configdir)

    Even though this is an internal cache, we should document that we are moving it on windows (as I'm sure there exist other users who have discovered where it lives and are either deleting it (for reasons) or pre-populating it (again, for reasons).

  2. added this to the v3.6.0 milestone on Aug 2, 2021
  3. tacaswell commented on Aug 2, 2021

    Member

    Milestoned for 3.6, but if it is ready it can go in for 3.5. Labeled good first issue because it only requires changing details of how we discover the cache directory and should not touch our public API (other than a sideeffect of where files go), but may require intermediate Python (as I think we want to generalize _get_xgd_cache_dir to also have a windows path) and familiarity with Windows.

  4. Erithax commented on Aug 2, 2021

    Author

    Do you have a reference for what "should" be in various places?

    https://docs.microsoft.com/en-us/windows/apps/design/app-settings/store-and-retrieve-app-data

  5. NeilGirdhar commented on Aug 16, 2021

    (as I think we want to generalize _get_xgd_cache_dir to also have a windows path) and familiarity with Windows.

    Why not just use appdirs as suggested in #12549?

  6. StefRe commented on Nov 25, 2021

    Contributor

    Move the directory to a subdirectory in %APPDATA%, where it belongs (as the name suggests).

    I think it should go into %LOCALAPPDATA%, not %APPDATA% which is for roaming app data. Cached fonts data are certainly not applicable on other devices. See also https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid.

  7. StefRe commented on Nov 25, 2021

    Contributor

    On Windows, the get_configdir and get_cachedir currently return the same value:

    elif sys.platform.startswith(('linux', 'freebsd')):
    # Only call _xdg_base_getter here so that MPLCONFIGDIR is tried first,
    # as _xdg_base_getter can throw.
    configdir = Path(xdg_base_getter(), "matplotlib")
    else:
    configdir = Path.home() / ".matplotlib"

    On Windows, I think we need to differentiate between %APPDATA% for roaming config data (get_configdir) and %LOCALAPPDATA% for local cache data (get_cachedir).

  8. NeilGirdhar commented on Nov 26, 2021

    @StefRe I think it should go into %LOCALAPPDATA%, not %APPDATA% which is for roaming app data.

    appdirs already figures this out for you if you pass roaming=True: https://github.com/ActiveState/appdirs/blob/8eacfa312d77aba28d483fbfb6f6fc54099622be/appdirs.py#L165

  9. StefRe commented on Nov 26, 2021

    Contributor

    @NeilGirdhar Thanks for mentioning, but all I wanted to say was just what files should go to what folders, not how to obtain these folder locations.

  10. StefRe commented on Nov 26, 2021

    Contributor

    @tacaswell If we want to fix this particular issue #20779 for Windows, I can make a PR.
    (Switching to appdirs #12549 is beyond me as I have no masOS or FreeBSD to test it and update the documention of get_configdir and get_cachedir. I couldn't find docs for appdirs (apart from the README file) that we could refer to for the details about folder selection on different OSs.)

  11. NeilGirdhar commented on Nov 26, 2021

    @StefRe Yes, I understand, but if you're going to fix this, I really think using appdirs is the right approach. They have already tested to make sure that their folder choices are correct. Otherwise, you'll just be fixing it for one OS for now, and it could easily break again one day. More importantly, the folders are messed up on all operating systems for the rest of us.

    I also don't think it's that much harder to use appdirs than to do this manually. Just call appdirs.user_data_dir(appname='matplotlib', appauthor='matplotlib', version=..., roaming=False) and use that path.

  12. 2 remaining items

  13. modified the milestones: v3.6.0, v3.7.0 on Aug 24, 2022
  14. jkseppan commented on Jun 15, 2025

    Member

    appdirs is now deprecated; the replacement is platformdirs

  15. VedantMadane commented on Jan 16, 2026

    Contributor

    Hi, I'd like to work on this issue. I'll implement the change to use \platformdirs\ (the maintained replacement for \�ppdirs) to properly place the matplotlib configuration and cache directories on Windows (%LOCALAPPDATA% for cache, %APPDATA% for config if roaming is desired, otherwise %LOCALAPPDATA%).

  16. added a commit that references this issue on Jan 16, 2026
    df18bbf
  17. added a commit that references this issue on Feb 10, 2026
    f3f8389
  18. added a commit that references this issue on Mar 2, 2026
    6dd3a69
  19. added a commit that references this issue on Mar 2, 2026
    0984d6d
  20. NeilGirdhar commented on Mar 2, 2026

    @timhoffm Could you please reopen the issue? This is only fixed on Windows, and in a very brittle way. Or perhaps we should open a separate issue for relying on platformdirs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS: Microsoft🌱 Good first issueOpen a pull request against these issues if there are no active ones!

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL