matplotlib requires write perms and space in $HOME

Hi,
  I am running some script in /mnt/blah and while my $HOME disk on a different device filled up
because of some other reason. But my script ran in /mnt/blah died as well while there is plenty
of space. Here is the stacktrace.

    import matplotlib
  File "/usr/lib64/python2.7/site-packages/matplotlib/__init__.py", line 765, in <module>
    rcParams = rc_params()
  File "/usr/lib64/python2.7/site-packages/matplotlib/__init__.py", line 683, in rc_params
    fname = matplotlib_fname()
  File "/usr/lib64/python2.7/site-packages/matplotlib/__init__.py", line 595, in matplotlib_fname
    fname = os.path.join(get_configdir(), 'matplotlibrc')
  File "/usr/lib64/python2.7/site-packages/matplotlib/__init__.py", line 246, in wrapper
    ret = func(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/matplotlib/__init__.py", line 467, in _get_configdir
    if not _is_writable_dir(p):
  File "/usr/lib64/python2.7/site-packages/matplotlib/__init__.py", line 176, in _is_writable_dir
    t.close()
IOError: [Errno 28] No space left on device

  Is this kind of check necessary at all? This is matplotlib-1.1.0 on Linux.
Thank you,
Martin

Hi,
I am running some script in /mnt/blah and while my $HOME disk on a different device filled up
because of some other reason. But my script ran in /mnt/blah died as well while there is plenty
of space. Here is the stacktrace.

Try setting the MPLCONFIGDIR environment variable to the writable dir or your choice.

mpl does need a place to store some files, which is $HOME/.matplotlib by default, but you can configure it.

···

On Jun 18, 2012, at 6:19 AM, Martin Mokrejs <mmokrejs@...3951...> wrote:

John Hunter wrote:

Hi,
I am running some script in /mnt/blah and while my $HOME disk on a different device filled up
because of some other reason. But my script ran in /mnt/blah died as well while there is plenty
of space. Here is the stacktrace.

Try setting the MPLCONFIGDIR environment variable to the writable dir or your choice.

mpl does need a place to store some files, which is $HOME/.matplotlib by default, but you can configure it.

Hmm. Could it be by default the current working directory instead? Or, try/else added to the code
which would try to write into cwd if $HOME (aka $MPLCONFIGDIR) returns an error?

I will set the variable in my scripts but too late for those already in the queue. :wink: Thanks.

Martin

···

On Jun 18, 2012, at 6:19 AM, Martin Mokrejs <mmokrejs@...3951...> wrote:

The stuff we store there is meant to be persistent between runs,
primarily a cache of all the fonts we find on your system. So
defaulting to the current working directory is not a good idea because
then we would have configs littered across the filesystem and would
not be able to take advantage of the information gleaned from previous
runs from other directories.

JDH

···

On Mon, Jun 18, 2012 at 7:29 AM, Martin Mokrejs <mmokrejs@...3951...> wrote:

Hmm. Could it be by default the current working directory instead? Or, try/else added to the code
which would try to write into cwd if $HOME (aka $MPLCONFIGDIR) returns an error?

However, should it be a full-out error? Is it possible to have mpl run without a font cache?

Just a thought.

Ben Root

···

On Mon, Jun 18, 2012 at 8:41 AM, John Hunter <jdh2358@…287…> wrote:

On Mon, Jun 18, 2012 at 7:29 AM, Martin Mokrejs > > <mmokrejs@…3951…> wrote:

Hmm. Could it be by default the current working directory instead? Or, try/else added to the code

which would try to write into cwd if $HOME (aka $MPLCONFIGDIR) returns an error?

The stuff we store there is meant to be persistent between runs,

primarily a cache of all the fonts we find on your system. So

defaulting to the current working directory is not a good idea because

then we would have configs littered across the filesystem and would

not be able to take advantage of the information gleaned from previous

runs from other directories.

JDH

I'm sure we could, but from an implementation perspective it would
probably be easier to spoof it with a virtual filesystem and files
using string io or equivalent. I think this would be a good feature
if anyone wants to pursue it.

JDH

···

On Mon, Jun 18, 2012 at 7:50 AM, Benjamin Root <ben.root@...1304...> wrote:

However, should it be a full-out error? Is it possible to have mpl run
without a font cache?