0

I installed matplotlib using pip. But I couldn't import this when I tried in ipython notebook. I wrote,

import matplotlib.pyplot as plt

and outputs is

--------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-67-eff513f636fd> in <module>()
----> 1 import matplotlib.pyplot as plt

/Users/yuchi/.pyenv/versions/3.5.0rc1/lib/python3.5/site-packages/matplotlib/__init__.py in <module>()
1129 
1130 # this is the instance used by the matplotlib classes
-> 1131 rcParams = rc_params()
1132 
1133 if rcParams['examples.directory']:

/Users/yuchi/.pyenv/versions/3.5.0rc1/lib/python3.5/site- packages/matplotlib/__init__.py in rc_params(fail_on_error)
 973         return ret
 974 
 --> 975     return rc_params_from_file(fname, fail_on_error)
 976 
 977 

/Users/yuchi/.pyenv/versions/3.5.0rc1/lib/python3.5/site-packages/matplotlib/__init__.py in rc_params_from_file(fname, fail_on_error, use_default_template)
1098         parameters specified in the file. (Useful for updating dicts.)
1099     """
-> 1100     config_from_file = _rc_params_in_file(fname, fail_on_error)
1101 
1102     if not use_default_template:

/Users/yuchi/.pyenv/versions/3.5.0rc1/lib/python3.5/site-packages/matplotlib/__init__.py in _rc_params_in_file(fname, fail_on_error)
1016     cnt = 0
1017     rc_temp = {}
 -> 1018     with _open_file_or_url(fname) as fd:
1019         try:
1020             for line in fd:

/Users/yuchi/.pyenv/versions/3.5.0rc1/lib/python3.5/contextlib.py in __enter__(self)
  57     def __enter__(self):
  58         try:
 ---> 59             return next(self.gen)
  60         except StopIteration:
  61             raise RuntimeError("generator didn't yield") from None

/Users/yuchi/.pyenv/versions/3.5.0rc1/lib/python3.5/site-packages/matplotlib/__init__.py in _open_file_or_url(fname)
 998     else:
 999         fname = os.path.expanduser(fname)
 -> 1000         encoding = locale.getdefaultlocale()[1]
1001         if encoding is None:
1002             encoding = "utf-8"

/Users/yuchi/.pyenv/versions/3.5.0rc1/lib/python3.5/locale.py in getdefaultlocale(envvars)
 557     else:
 558         localename = 'C'
 --> 559     return _parse_localename(localename)
 560 
 561 

/Users/yuchi/.pyenv/versions/3.5.0rc1/lib/python3.5/locale.py in _parse_localename(localename)
 485     elif code == 'C':
 486         return None, None
 --> 487     raise ValueError('unknown locale: %s' % localename)
 488 
 489 def _build_localename(localetuple):

ValueError: unknown locale: UTF-8

Please tell me the solution for this.

  • Have you tried [this solution](http://stackoverflow.com/questions/19961239/pelican-3-3-pelican-quickstart-error-valueerror-unknown-locale-utf-8)? – j08lue Feb 09 '16 at 08:52
  • When you get an error in Python, look up just the error, like `ValueError: unknown locale: UTF-8`, seasoned with `python` and perhaps the name of the module, and you will find... – j08lue Feb 09 '16 at 08:57
  • I tried that solution and I could import matplotlib. Thanks! – Yuchi Matsuoka Mar 19 '16 at 12:50

0 Answers0