IPython Notebook locale error
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-8
export 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-8
export LANG=fr_CH.UTF-8
Using pylab with ipython - ValueError: unknown locale: UTF-8
You may need to add the following lines to your ~/.bash_profile:
$ nano ~/.bash_profile
OR
$ vi ~/.bash_profile
Add these lines to the end of the file
$ export LC_ALL=en_US.UTF-8
$ export LANG=en_US.UTF-8
Once you have those lines saved in your profile, log out and back in to the shell and it should work.
Error using matplotlib after updating iPython
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.
Error while trying to launch IPython Notebook from Anaconda
This is an issue with the Mac OS X Terminal. You should change your bash profile to set LANG
to the correct string for your locale. Another workaround would be to uncheck the "Set LANG environment variable on startup" setting in the Terminal preferences.
See https://code.djangoproject.com/ticket/5846 for more information.
Change jupyter notebook warnings language
It seems to work, just by adding these two lines, as suggested in the last answer of this other question
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
credits to Keith Hughitt
Python 2.7 on MacOS : Matplotlib causing ValueError: unknown locale: UTF-8
It's unknown locale error. Add these lines in your ~/.bash_profile
file:
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
Also run this command in the terminal to reload the file.
source ~/.bash_profile
pip install - locale.Error: unsupported locale setting
The root cause is: your environment variable LC_ALL
is missing or invalid somehow
Short answer-
just run the following command:
$ export LC_ALL=C
If you keep getting the error in new terminal windows, add it at the bottom of your .bashrc
file.
Long answer-
Here is my locale
settings:
$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=C
Python2.7
$ uname -a
Linux debian 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u6 (2015-11-09) x86_64 GNU/Linux
$ python --version
Python 2.7.9
$ pip --version
pip 8.1.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)
$ unset LC_ALL
$ pip install virtualenv
Traceback (most recent call last):
File "/usr/local/bin/pip", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/pip/__init__.py", line 215, in main
locale.setlocale(locale.LC_ALL, '')
File "/usr/lib/python2.7/locale.py", line 579, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting
$ export LC_ALL=C
$ pip install virtualenv
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /usr/local/lib/python2.7/dist-packages
ValueError: unknown locale: UTF-8 when importing pandas in python 2.7
Looks like you're on OS X. Append this to your ~/.bash_profile
:
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
And then run:
$ source ~/.bash_profile
Now try import pandas
.
Related Topics
How to Check If a Variable Exists
Extract File Name from Path, No Matter What the Os/Path Format
Explanation of How Nested List Comprehension Works
Store Output of Subprocess.Popen Call in a String
Is There Any Pythonic Way to Combine Two Dicts (Adding Values For Keys That Appear in Both)
Difference Between Del, Remove, and Pop on Lists
Find If 24 Hrs Have Passed Between Datetimes
Pandas Percentage of Total With Groupby
How to Make One Python File Run Another
How to Find All Matches to a Regular Expression in Python
Python Rounding Error With Float Numbers
Convert Python Dict into a Dataframe
How to Save and Load Cookies Using Python + Selenium Webdriver
Are List-Comprehensions and Functional Functions Faster Than "For Loops"
How to Modify List Entries During For Loop