Closed
Description
I am trying to use matplotlib inside a Docker container running as non root. When I do I get the following:
$ docker run -u 5001 -it 4catalyzer/ipython python -c 'import matplotlib'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/matplotlib/__init__.py", line 1131, in <module>
rcParams = rc_params()
File "/usr/local/lib/python2.7/dist-packages/matplotlib/__init__.py", line 965, in rc_params
fname = matplotlib_fname()
File "/usr/local/lib/python2.7/dist-packages/matplotlib/__init__.py", line 794, in matplotlib_fname
configdir = _get_configdir()
File "/usr/local/lib/python2.7/dist-packages/matplotlib/__init__.py", line 649, in _get_configdir
return _get_config_or_cache_dir(_get_xdg_config_dir())
File "/usr/local/lib/python2.7/dist-packages/matplotlib/__init__.py", line 626, in _get_config_or_cache_dir
return _create_tmp_config_dir()
File "/usr/local/lib/python2.7/dist-packages/matplotlib/__init__.py", line 555, in _create_tmp_config_dir
tempdir = os.path.join(tempdir, 'matplotlib-%s' % getpass.getuser())
File "/usr/lib/python2.7/getpass.py", line 158, in getuser
return pwd.getpwuid(os.getuid())[0]
KeyError: 'getpwuid(): uid not found: 5001'
Potentially just have getpass.getuser()
then fall back to the UID value.