My second snap ;-)
Robert Park
robert.park at canonical.com
Wed Oct 5 01:44:03 UTC 2016
Thanks again Loic, I was finally able to achieve a snapped matplotlib
(well, the current traceback I'm seeing is at least from my own app so
I can iterate on that, matplotlib seems happy enough at least).
The trick is that you can't just set $MATPLOTLIBDATA to any old dir
because matplotlib expects to find fonts in there in addition to the
matplotlibrc. So in the end I needed this in my snapcraft.yaml:
parts:
myapp:
plugin: dump
source: .
stage-packages:
- python3-matplotlib
- python3-numpy
- python3-tk
organize:
etc/matplotlibrc: usr/share/matplotlib/mpl-data/matplotlibrc
(that usr/share... path is where python3-matplotlib installs fonts to)
Then I needed a wrapper like this:
#!/bin/sh
export MATPLOTLIBRC="$SNAP/usr/share/matplotlib/mpl-data"
export MATPLOTLIBDATA="$MATPLOTLIBRC"
exec "$SNAP/myapp.py" "$@"
For some reason it didn't seem to work just by setting $MATPLOTLIBRC,
it just gave a different traceback, instead of getting permission
denied on /etc/matplotlibrc it raised some error about not being able
to find any config data at all. setting both vars and having the
matplotlibrc in the same dir as the fonts was the only way I could get
it to work.
More information about the Snapcraft
mailing list