pip install - locale.Error: unsupported locale setting pip install - locale.Error: unsupported locale setting python python

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:

$ localeLANG=en_US.UTF-8LANGUAGE=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


Run the following command (it will work):

export LC_ALL="en_US.UTF-8"export LC_CTYPE="en_US.UTF-8"sudo dpkg-reconfigure locales


Someone may find it useful. You could put those locale settings in .bashrc file, which usually located in the home directory.
Just add this command in .bashrc:
export LC_ALL=C
then type source .bashrc
Now you don't need to call this command manually every time, when you connecting via ssh for example.


matomo