Locale error during install/update/ssh

Hi everyone,

If you face one of these errors, see the below solution:

  1. On doing SSH:

    -bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
    
  2. On checking locale:

    [root@example ~]# locale
    locale: Cannot set LC_CTYPE to default locale: No such file or directory
    locale: Cannot set LC_ALL to default locale: No such file or directory
    LANG=en_US.UTF-8
    ...
    
  3. During bench update:

     Traceback (most recent call last):
     File "./env/bin/pip", line 11, in <module>
         sys.exit(main())
     File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/pip/__init__.py", line 215, in main
         locale.setlocale(locale.LC_ALL, '')
     File "/home/frappe/frappe-bench/env/lib64/python2.7/locale.py", line 547, in setlocale
         return _setlocale(category, locale)
     locale.Error: unsupported locale setting
     Please install these dependencies using the command:
     sudo yum install libtiff-devel libjpeg-devel libzip-devel freetype-devel lcms2-devel libwebp-devel tcl-devel tk-devel
    

Solution:

sudo vim /etc/locale.conf

# and add this
LANG="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
6 Likes