~/.matplotlib owned by root makes life with Python difficult

Philip Semanchuk philip at semanchuk.com
Wed Oct 27 21:54:05 UTC 2010


Hi all,
I'm on a fresh install of 10.10 with the latest updates available as of today. I installed a few packages via the Synaptic Package Manager including matplotlib (0.99.3). The install went fine except that the critical directory ~/.matplotlib is owned by root rather than by me. This is the output from ls -la:
drwxr-xr-x  2 root root 4096 2010-10-27 17:23 .matplotlib

This leaves me unable to use matplotlib from Python (unless I run Python via sudo):

$ python -c "import matplotlib"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/pymodules/python2.6/matplotlib/__init__.py", line 711, in <module>
    rcParams = rc_params()
  File "/usr/lib/pymodules/python2.6/matplotlib/__init__.py", line 629, in rc_params
    fname = matplotlib_fname()
  File "/usr/lib/pymodules/python2.6/matplotlib/__init__.py", line 567, in matplotlib_fname
    fname = os.path.join(get_configdir(), 'matplotlibrc')
  File "/usr/lib/pymodules/python2.6/matplotlib/__init__.py", line 240, in wrapper
    ret = func(*args, **kwargs)
  File "/usr/lib/pymodules/python2.6/matplotlib/__init__.py", line 436, in _get_configdir
    raise 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))
RuntimeError: '/home/me' is not a writable dir; you must set /home/me/.matplotlib to be a writable dir.  You can also set environment variable MPLCONFIGDIR to any writable directory where you want matplotlib data stored 

If I change ~/.matplotlib to be owned by my username (sudo chown -R me:me ~/.matplotlib), then the command above runs without errors.

Am I missing something, or is this a bug in the Ubuntu version of the matplotlib package? Should I file a bug?

Thanks
Philip






More information about the ubuntu-users mailing list