0

import matplotlib shows the following errors:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/user/anaconda/lib/python2.7/site-packages/matplotlib/__init__.py", line 1130, in <module>
rcParams = rc_params()
File "/Users/user/anaconda/lib/python2.7/site-packages/matplotlib/__init__.py", line 974, in rc_params
return rc_params_from_file(fname, fail_on_error)
File "/Users/user/anaconda/lib/python2.7/site-packages/matplotlib/__init__.py", line 1099, in rc_params_from_file
config_from_file = _rc_params_in_file(fname, fail_on_error)
File "/Users/user/anaconda/lib/python2.7/site-packages/matplotlib/__init__.py", line 1017, in _rc_params_in_file
with _open_file_or_url(fname) as fd:
File "/Users/user/anaconda/lib/python2.7/contextlib.py", line 18, in __enter__
return self.gen.next()
File "/Users/user/anaconda/lib/python2.7/site-packages/matplotlib/__init__.py", line 999, in _open_file_or_url
encoding = locale.getdefaultlocale()[1]
File "/Users/user/anaconda/lib/python2.7/locale.py", line 543, in getdefaultlocale
return _parse_localename(localename)
File "/Users/user/anaconda/lib/python2.7/locale.py", line 475, in _parse_localename
raise ValueError, 'unknown locale: %s' % localename
TypeError: unsupported operand type(s) for &: 'str' and 'str'

The same errors show when - from matplotlib import pyplot - is used. At first I thought the problem was because I didn't install matplotlib correctly. I initially tried with homebrew's python and after surfing through hundreds of guides on how to install it correctly, gave up out of sheer frustration. Then I tried with anaconda's python and again I got the same errors. Could someone please help me out here?

Chewpers
  • 2,430
  • 5
  • 23
  • 30
  • In bash, what does `locale` return? – unutbu Jan 20 '16 at 17:20
  • @unutbu LANG= LC_COLLATE="C" LC_CTYPE="UTF-8" LC_MESSAGES="C" LC_MONETARY="C" LC_NUMERIC="C" LC_TIME="C" LC_ALL= – Vignesh Prasad Jan 20 '16 at 18:08
  • In python, what does `import locale; print(locale.getdefaultlocale())` return? – unutbu Jan 20 '16 at 18:16
  • @unutbu Traceback (most recent call last): File "", line 1, in File "/Users/vigneshprasad/anaconda/lib/python2.7/locale.py", line 543, in getdefaultlocale return _parse_localename(localename) File "/Users/vigneshprasad/anaconda/lib/python2.7/locale.py", line 475, in _parse_localename raise ValueError, 'unknown locale: %s' % localename – Vignesh Prasad Jan 20 '16 at 19:00
  • Your symptoms seem similar to those in [this question](http://stackoverflow.com/q/15526996/190597). Perhaps try the solution posted there. – unutbu Jan 20 '16 at 19:08
  • @unubtu Thanks!!! It worked!!! – Vignesh Prasad Jan 20 '16 at 19:56
  • Yay! I'm going to close this as a dup of http://stackoverflow.com/q/15526996/190597 then. – unutbu Jan 20 '16 at 20:01

0 Answers0