ValueError: unknown locale: UTF-8
ValueError: unknown locale: UTF-8
Date posted : 07/06/2019
There are times when install some packages, you will end getting this error due to locale issue.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/pheonix/webapp/lib/python2.7/site-
packages/pandas/__init__.py", line 39, in <module>
from pandas.core.api import *
File "/Users/pheonix/webapp/lib/python2.7/site- packages/pandas/core/api.py", line 10, in <module>
from pandas.core.groupby import Grouper
File "/Users/pheonix/webapp/lib/python2.7/site-packages/pandas/core/groupby.py", line 18, in <module>
from pandas.core.frame import DataFrame
File "/Users/pheonix/webapp/lib/python2.7/site-packages/pandas/core/frame.py", line 39, in <module>
from pandas.core.series import Series
File "/Users/pheonix/webapp/lib/python2.7/site-packages/pandas/core/series.py", line 2944, in <module>
import pandas.tools.plotting as _gfx # noqa
File "/Users/pheonix/webapp/lib/python2.7/site-packages/pandas/tools/plotting.py", line 27, in <module>
import pandas.tseries.converter as conv
File "/Users/pheonix/webapp/lib/python2.7/site- packages/pandas/tseries/converter.py", line 7, in <module>
import matplotlib.units as units
File "/Users/pheonix/webapp/lib/python2.7/site-packages/matplotlib/__init__.py", line 1131, in <module>
rcParams = rc_params()
File "/Users/pheonix/webapp/lib/python2.7/site-
packages/matplotlib/__init__.py", line 975, in rc_params
return rc_params_from_file(fname, fail_on_error)
File "/Users/pheonix/webapp/lib/python2.7/site-packages/matplotlib/__init__.py", line 1100, in rc_params_from_file
config_from_file = _rc_params_in_file(fname, fail_on_error)
File "/Users/pheonix/webapp/lib/python2.7/site-packages/matplotlib/__init__.py", line 1018, in _rc_params_in_file
with _open_file_or_url(fname) as fd:
File "/Users/pheonix/webapp/lib/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
File "/Users/pheonix/webapp/lib/python2.7/site- packages/matplotlib/__init__.py", line 1000, in _open_file_or_url
encoding = locale.getdefaultlocale()[1]
File "/Users/pheonix/webapp/lib/python2.7/locale.py", line 545, in getdefaultlocale
return _parse_localename(localename)
File "/Users/pheonix/webapp/lib/python2.7/locale.py", line 477, in _parse_localename
raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8
Solution:
You need to add locale settings in environment file.
Open the file and append below lines.
$ vim /etc/environment
LANG=en_US.utf-8<br> LC_ALL=en_US.utf-8
Thanks for using pheonix solutions.
You find this tutorial helpful? Share with your friends to keep it alive.