Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error using matplotlib after updating iPython [duplicate]

After updating IPython I constantly have problems with matplotlib. At the beginning of my notebook I have

%matplotlib inline
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
import scipy
from qutip import *
import time

Which generate a screen full of issues but the final part is

/Users/murray/anaconda/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

There were other issues before this which I managed to fix. Similar things have been reported here but no solution which works for me. One solution I found online suggested running

export LANG="it_IT.UTF-8"

in the terminal window (plus about 8 other similar commands). This worked but everytime I restart the notebook I have to reenter all of this. As you might guess I am not an expert - I would assume there is a more permanent fix for this problem

like image 968
user3799584 Avatar asked Jul 22 '26 16:07

user3799584


1 Answers

As a work around, you can put export LANG="it_IT.UTF-8" and the "8 other similar commands" into your .profile (assuming your are on Mac OS X). At the end of this file /Users/murray/.profile write:

# Fix for matplotlib imports in IPython
export LANG="it_IT.UTF-8"
# your other 8 lines here without the # in front

You need to start a new terminal window. In there, start a new IPython session.

like image 120
Mike Müller Avatar answered Jul 24 '26 07:07

Mike Müller



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!