Fixing locale issues
From Newroco Tech Docs
Jump to navigationJump to search
If you get errors when installing packages regarding locale, e.g.
locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_MESSAGES to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: No such file or directory
Or issues with Python PIP e.g. when trying to use Certbot like
Creating virtual environment... Traceback (most recent call last): File "/usr/lib/python3/dist-packages/virtualenv.py", line 2363, in <module> main() File "/usr/lib/python3/dist-packages/virtualenv.py", line 719, in main symlink=options.symlink) File "/usr/lib/python3/dist-packages/virtualenv.py", line 988, in create_environment download=download, File "/usr/lib/python3/dist-packages/virtualenv.py", line 918, in install_wheel call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT) File "/usr/lib/python3/dist-packages/virtualenv.py", line 812, in call_subprocess % (cmd_desc, proc.returncode))
Then you may need to install and/or set your locale files. You can check by running
localectl list-locales
and if the output is just something like
C.UTF-8
Then as root do
apt-get install language-pack-en* update-locale LANG=en_GB.UTF-8 LC_MESSAGES=POSIX
Your preferred locale name may vary