3

I've recently upgraded to Python 3.5 and the newest version of pandas pandas (0.17.1), but this broke the package for me. I'm on Mac OS X 10.9.5, using the fish shell. What can I do?

cls@clsmba ~> python3
Python 3.5.0 (default, Sep 23 2015, 04:41:33) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/site-packages/pandas/__init__.py", line 44, in <module>
    from pandas.core.api import *
  File "/usr/local/lib/python3.5/site-packages/pandas/core/api.py", line 9, in <module>
    from pandas.core.groupby import Grouper
  File "/usr/local/lib/python3.5/site-packages/pandas/core/groupby.py", line 17, in <module>
    from pandas.core.frame import DataFrame
  File "/usr/local/lib/python3.5/site-packages/pandas/core/frame.py", line 41, in <module>
    from pandas.core.series import Series
  File "/usr/local/lib/python3.5/site-packages/pandas/core/series.py", line 2909, in <module>
    import pandas.tools.plotting as _gfx
  File "/usr/local/lib/python3.5/site-packages/pandas/tools/plotting.py", line 28, in <module>
    import pandas.tseries.converter as conv
  File "/usr/local/lib/python3.5/site-packages/pandas/tseries/converter.py", line 7, in <module>
    import matplotlib.units as units
  File "/usr/local/lib/python3.5/site-packages/matplotlib/__init__.py", line 1131, in <module>
    rcParams = rc_params()
  File "/usr/local/lib/python3.5/site-packages/matplotlib/__init__.py", line 975, in rc_params
    return rc_params_from_file(fname, fail_on_error)
  File "/usr/local/lib/python3.5/site-packages/matplotlib/__init__.py", line 1100, in rc_params_from_file
    config_from_file = _rc_params_in_file(fname, fail_on_error)
  File "/usr/local/lib/python3.5/site-packages/matplotlib/__init__.py", line 1018, in _rc_params_in_file
    with _open_file_or_url(fname) as fd:
  File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/contextlib.py", line 59, in __enter__
    return next(self.gen)
  File "/usr/local/lib/python3.5/site-packages/matplotlib/__init__.py", line 1000, in _open_file_or_url
    encoding = locale.getdefaultlocale()[1]
  File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/locale.py", line 559, in getdefaultlocale
    return _parse_localename(localename)
  File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/locale.py", line 487, in _parse_localename
    raise ValueError('unknown locale: %s' % localename)
ValueError: unknown locale: UTF-8
clstaudt
  • 21,436
  • 45
  • 156
  • 239

2 Answers2

8

for fish shell

set -x LC_ALL en_US.UTF-8 
set -x LANG en_US.UTF-8
Community
  • 1
  • 1
  • Yes, adding these lines to `~/.config/fish/config.fish` solves the issue. – clstaudt Nov 24 '15 at 17:54
  • 3
    You _don't_ want to set LC_ALL - that's a sledgehammer meant for debugging or overriding. – faho Nov 25 '15 at 13:36
  • 2
    This is only the correct answer if you speak English and live in the US, which is virtually never the case for people who see this issue. In general you should set this to the correct code for your locale (`locale -a` will list them all). – asmeurer Aug 18 '16 at 06:23
1

Make sure you have your terminal set to export appropriate locale variables, as described in this answer, and that your region is set correctly in System Preferences.

Community
  • 1
  • 1
Zanchey
  • 1,941
  • 1
  • 15
  • 23
  • It seems that both was already set correctly, so I can't confirm that this would have fixed my issue. – clstaudt Nov 27 '15 at 03:35