Jump to content

Help:Locale errors

From Wikitech
This page contains historical information. It may be outdated or unreliable.
Ubuntu-specific information.


Locale errors are associated with the language of a system. These typically occur on new instances in Wikimedia Cloud VPS.

This page will show you how to solve this issue.

How do locale errors happen?

Using the pywikipediabot's interwiki.py script as an example here.

Immediately after creating the new instance that you would like to use, you may see errors like:

Traceback (most recent call last):
  File "interwiki.py", line 375, in <module>
    import wikipedia as pywikibot
  File "/home/hydriz/pywikipedia/wikipedia.py", line 147, in <module>
    locale.setlocale(locale.LC_ALL, '')
  File "/usr/lib/python2.7/locale.py", line 539, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_TIME = "en_SG.UTF-8",
	LC_ADDRESS = "en_SG.UTF-8",
	LC_NAME = "en_SG.UTF-8",
	LC_NUMERIC = "en_SG.UTF-8",
	LC_PAPER = "en_SG.UTF-8",
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_ALL to default locale: No such file or directory

Such errors can break the interwiki bot script, making the script totally useless on that instance.


Run the following command to install the required language packs:

sudo apt-get install language-pack-en-base

And to also rebuild it again to ensure it works:

sudo dpkg-reconfigure locales

...and you are done!

Communication and support

Support and administration of the WMCS resources is provided by the Wikimedia Foundation Cloud Services team and Wikimedia movement volunteers. Please reach out with questions and join the conversation:

Discuss and receive general support
Stay aware of critical changes and plans
Track work tasks and report bugs

Use a subproject of the #Cloud-Services Phabricator project to track confirmed bug reports and feature requests about the Cloud Services infrastructure itself

Read stories and WMCS blog posts

Read the Cloud Services Blog (for the broader Wikimedia movement, see the Wikimedia Technical Blog)