Description
Bug summary
~/.config/matplotlib
is never used because ~/.config
is a symlink.
Code for reproduction
On Linux, do:
cd ~
mkdir -p .config/matplotlib
mkdir myfakedisk
mv .config myfakedisk
ln -s ~/myfakedisk/.config
<run a matplotlib program>
Actual outcome
Matplotlib created a temporary cache directory at /some/tmp/path because the default path (/home/myuser/.config/matplotlib) is not a writable directory; it is highly recommended to set the MPLCONFIGDIR environment variable to a writable directory, in particular to speed up the import of Matplotlib and to better support multiprocessing.
Expected outcome
No warning, and not using a directory in /tmp
Additional information
Because ~/.config
is now technically a symlink instead of a directory, matplotlib emits the warning above and then uses a temp directory instead.
Nearly every other program I can think of will let me use symlinks for config dirs. I think matplotlib should allow this use case.
Just to be explicit about what my use case is - my company gives us 100 MB home directories, and then they give us dedicated disks that actually have enough space to do work on. So I have to symlink various config dirs in my home directory to my allocated disk, as the 100 MB gets used up fast.
It's a simple fix, and I'll open a PR to fix it.
Operating system
Linux
Matplotlib Version
Unknown, but it looks like it's been this way for at least 5 years, ever since #15933.
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
None