When I try to import matplotlib.pyplot I get the following error:
RuntimeError("'%s' is not a writable dir; you must set %s/.matplotlib to be a writable dir. You can also set environment variable MPLCONFIGDIR to any writable directory where you want matplotlib data stored "% (h, h))
I do have a .matplotlib directory in my home directory which is owned by me and has write permissions on. So why is it telling me it is "not a writable dir" and how do I fix this?
Don't run Python as root; it not really safe, and you will potentially just run into more permissions issues later. Instead, just make sure you own the home directory and matplotlib directory:
sudo chown $USER ~ ~/.matplotlib
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With