0

am new to python and struglling to use the ipython on mac. Some body told me to use the anaconda, ipython notebook for help.

I installed the anaoconda on my mac. I have to use the numpy,scipy and matplotlib frameworks numpy, scipy works fine but the matplotlib thows error when I try to use it. or %pylab throws error.

I dont understand whats the problem? Here's the screen shot for the same. enter image description here

Here's the full trace enter link description here

Here's the error (full stacktrace) in case if Link doesn't work

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-2-5c1faa999e5b> in <module>()
----> 1 get_ipython().magic(u'pylab')

/Users/abhi/anaconda2/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s)
   2334         magic_name, _, magic_arg_s = arg_s.partition(' ')
   2335         magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2336         return self.run_line_magic(magic_name, magic_arg_s)
   2337 
   2338     #-------------------------------------------------------------------------

/Users/abhi/anaconda2/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in run_line_magic(self, magic_name, line)
   2255                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2256             with self.builtin_trap:
-> 2257                 result = fn(*args,**kwargs)
   2258             return result
   2259 

/Users/abhi/anaconda2/lib/python2.7/site-packages/IPython/core/magics/pylab.pyc in pylab(self, line)

/Users/abhi/anaconda2/lib/python2.7/site-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k)
    191     # but it's overkill for just that one bit of state.
    192     def magic_deco(arg):
--> 193         call = lambda f, *a, **k: f(*a, **k)
    194 
    195         if callable(arg):

/Users/abhi/anaconda2/lib/python2.7/site-packages/IPython/core/magics/pylab.pyc in pylab(self, line)
    154             import_all = not args.no_import_all
    155 
--> 156         gui, backend, clobbered = self.shell.enable_pylab(args.gui, import_all=import_all)
    157         self._show_matplotlib_backend(args.gui, backend)
    158         print ("Populating the interactive namespace from numpy and matplotlib")

/Users/abhi/anaconda2/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in enable_pylab(self, gui, import_all, welcome_message)
   3169         from IPython.core.pylabtools import import_pylab
   3170 
-> 3171         gui, backend = self.enable_matplotlib(gui)
   3172 
   3173         # We want to prevent the loading of pylab to pollute the user's

/Users/abhi/anaconda2/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in enable_matplotlib(self, gui)
   3118         """
   3119         from IPython.core import pylabtools as pt
-> 3120         gui, backend = pt.find_gui_and_backend(gui, self.pylab_gui_select)
   3121 
   3122         if gui != 'inline':

/Users/abhi/anaconda2/lib/python2.7/site-packages/IPython/core/pylabtools.pyc in find_gui_and_backend(gui, gui_select)
    237     """
    238 
--> 239     import matplotlib
    240 
    241     if gui and gui != 'auto':

/Users/abhi/anaconda2/lib/python2.7/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/abhi/anaconda2/lib/python2.7/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/abhi/anaconda2/lib/python2.7/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/abhi/anaconda2/lib/python2.7/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/abhi/anaconda2/lib/python2.7/contextlib.pyc in __enter__(self)
     15     def __enter__(self):
     16         try:
---> 17             return self.gen.next()
     18         except StopIteration:
     19             raise RuntimeError("generator didn't yield")

/Users/abhi/anaconda2/lib/python2.7/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/abhi/anaconda2/lib/python2.7/locale.pyc in getdefaultlocale(envvars)
    541     else:
    542         localename = 'C'
--> 543     return _parse_localename(localename)
    544 
    545 

/Users/abhi/anaconda2/lib/python2.7/locale.pyc in _parse_localename(localename)
    473     elif code == 'C':
    474         return None, None
--> 475     raise ValueError, 'unknown locale: %s' % localename
    476 
    477 def _build_localename(localetuple):

ValueError: unknown locale: UTF-8
Thomas K
  • 39,200
  • 7
  • 84
  • 86
Jasmeet
  • 1,522
  • 2
  • 22
  • 41
  • Could you post the full stacktrace? – rtemperv Jan 21 '16 at 23:41
  • @rtemperv updated my question, please look at the bottom. here's the full stacktrace http://pastie.org/10696434#13 – Jasmeet Jan 22 '16 at 00:12
  • link not loading, can't you just paste the text into the question directly? – Pyrce Jan 22 '16 at 02:02
  • @Pyrce I have updated the question, please have a look – Jasmeet Jan 22 '16 at 02:53
  • 1
    take a look at this question http://stackoverflow.com/questions/19961239/pelican-3-3-pelican-quickstart-error-valueerror-unknown-locale-utf-8: – maxymoo Jan 22 '16 at 03:40
  • @maxymoo Thanks a ton It worked!! whew, you have no idea from how many days I was facing this – Jasmeet Jan 22 '16 at 03:50
  • 1
    no probs, for future reference, I found the answer by doing a web search for "ValueError: unknown locale: UTF-8", which was the last line of your stacktrace, often this is the line which contains the important part of your error – maxymoo Jan 22 '16 at 03:52

1 Answers1

0

After a long hazel I found the answer as somebody posted a useful comment below the question

Just edit your .bash_profile file with the following vars

export LANG="it_IT.UTF-8"  
export LC_COLLATE="it_IT.UTF-8"  
export LC_CTYPE="it_IT.UTF-8"  
export LC_MESSAGES="it_IT.UTF-8"  
export LC_MONETARY="it_IT.UTF-8"  
export LC_NUMERIC="it_IT.UTF-8"  
export LC_TIME="it_IT.UTF-8"  
export LC_ALL=  

It worked for me. Some of the useful links 1 enter link description here 2 enter link description here

Community
  • 1
  • 1
Jasmeet
  • 1,522
  • 2
  • 22
  • 41