Hi, Right; matplotlib expects matplotlibrc to be installed. Looking at matplotlib/__init__.py, you can see rc_params() calls matplotlib_fname() to get the default config filename.
The search order there is: - `$PWD/matplotlibrc` - `$MATPLOTLIBRC/matplotlibrc` - `$MPLCONFIGDIR/matplotlibrc` - `$HOME/.matplotlib/matplotlibrc`, if it exists - or `$XDG_CONFIG_HOME/matplotlib/matplotlibrc` (if $XDG_CONFIG_HOME is defined) - or `$HOME/.config/matplotlib/matplotlibrc` (if $XDG_CONFIG_HOME is not defined) - `$HOME/.matplotlib/matplotlibrc` if `$HOME` is defined. - Lastly, it looks in `$MATPLOTLIBDATA/matplotlibrc` for a system-defined copy. So just create a matplotlibrc in your $SNAP and you should be good Cheers, - Loïc On Sun, Oct 2, 2016 at 9:54 AM, Robert Park <robert.p...@canonical.com> wrote: > Hi all! > > Back again with a second attempt, this time I'm not trying to modify > the host system so I'm hoping this should be a lot easier/possible! > > Here's my snapcraft.yaml: > > https://git.launchpad.net/~robru/+git/weightloss/tree/snapcraft.yaml > > Pretty simple little flask webapp, just does some data manipulations > and then serves graphics over HTTP. > > Snap builds ok but when I run it I get this: > > weighttracker > Traceback (most recent call last): > File "/snap/weighttracker/x2/run.py", line 15, in <module> > from graph import draw > File "/snap/weighttracker/x2/graph.py", line 14, in <module> > from matplotlib.dates import DateFormatter > File "/snap/weighttracker/x2/usr/lib/python3/dist-packages/ > matplotlib/__init__.py", > line 1133, in <module> > rcParams = rc_params() > File "/snap/weighttracker/x2/usr/lib/python3/dist-packages/ > matplotlib/__init__.py", > line 977, in rc_params > return rc_params_from_file(fname, fail_on_error) > File "/snap/weighttracker/x2/usr/lib/python3/dist-packages/ > matplotlib/__init__.py", > line 1102, in rc_params_from_file > config_from_file = _rc_params_in_file(fname, fail_on_error) > File "/snap/weighttracker/x2/usr/lib/python3/dist-packages/ > matplotlib/__init__.py", > line 1020, in _rc_params_in_file > with _open_file_or_url(fname) as fd: > File "/snap/weighttracker/x2/usr/lib/python3.5/contextlib.py", line > 59, in __enter__ > return next(self.gen) > File "/snap/weighttracker/x2/usr/lib/python3/dist-packages/ > matplotlib/__init__.py", > line 1005, in _open_file_or_url > with io.open(fname, encoding=encoding) as f: > PermissionError: [Errno 13] Permission denied: '/etc/matplotlibrc' > > > Not really sure what's going on, but it looks like matplotlib is > hard-coding "/etc": > > $ cat /snap/weighttracker/x2/usr/lib/python3/dist-packages/ > matplotlib/__init__.py > | grep /etc > path = '/etc' # guaranteed to exist or raise > > > Do I have to patch matplotlib here or is there some way snapcraft can > fix this for me? > > (frustratingly the matplotlib code seems to harmlessly ignore the file > if it doesn't exist, but they didn't anticipate the idea that they > wouldn't have permission, so the code just barfs) > > > > Thanks. > > -- > robru > > -- > Snapcraft mailing list > Snapcraft@lists.snapcraft.io > Modify settings or unsubscribe at: https://lists.ubuntu.com/ > mailman/listinfo/snapcraft > -- - Loïc
-- Snapcraft mailing list Snapcraft@lists.snapcraft.io Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/snapcraft