IPython Notebook locale error [duplicate] IPython Notebook locale error [duplicate] python python

IPython Notebook locale error [duplicate]


I summarize here the solution to be found on: http://blog.lobraun.de/2009/04/11/mercurial-on-mac-os-x-valueerror-unknown-locale-utf-8/

I added these lines to my .bash_profile:

export LC_ALL=en_US.UTF-8export LANG=en_US.UTF-8

I reloaded the profile:

source ~/.bash_profile

I then ran ipython again:

ipython notebook

Changing locales

The above will work for the English language in a US locale. One may want different settings.

At the risk of stating the obvious, to discover the current settings for your system, use:

$ locale

And to retrieve a list of all valid settings on your system:

$ locale -a

Then choose your preferred locale. For example, for a Swiss French locale, the solution would look like this:

export LC_ALL=fr_CH.UTF-8export LANG=fr_CH.UTF-8


This is a bug in the OS X Terminal app that only shows up in certain locales (country/language combinations). Open Terminal in /Applications/Utilities and uncheck the box “Set locale environment variables on startup”.

enter image description here

This will set your LANG environment variable to be empty. This may cause terminal use to incorrect settings for your locale. The locale command in the Terminal will tell you what settings are used. To use the correct language, add a line to your bash profile (typically ~/.profile)

export LANG=your-lang

Replace your-lang with the correct locale specifier for your language. The command locale -a will show you all the specifiers. For example, the language code for US English is en_US.UTF-8. The locale affects what translations are used when they are available, and also how dates, currencies, and decimals are formatted.

Note, this image and content were taken from http://conda.pydata.org/docs/troubleshooting.html#unknown-locale (I'm also the original author of that page).


in iTerm going to the menu

Preferences -> Profiles -> Terminal -> (Environment) 

and then unchecking

"Set locale variables automatically"

made this error go away.