Unsupported locale setting 'es_ES'

Hello team, I am trying to deploy an application which works perfectly on my localhost, but when I try to deploy and run it I get ‘Unsopported locale setting’
I am trying to use locale.setlocale(locale.LC_TIME, ‘es_ES’)

Traceback (most recent call last):
File “/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py”, line 535, in _run_script
exec(code, module.dict)
File “/mount/src/reservaweb/main.py”, line 8, in
locale.setlocale(locale.LC_TIME, ‘es_ES’)
File “/usr/local/lib/python3.9/locale.py”, line 610, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting

I saw in another topic that the issue was corrected by setting ‘ES’ as user locale setttings.
Could you please help me on this?

Thank you.

Hey @Agustin_Viera,

Have you tried the solution outlined here?

  • Create a packages.txt file and add the line locales-all
  • Make sure your Python code is the following:
import locale
locale.setlocale(locale.LC_ALL, "es_ES")

I’ve been trying the same thing with the locale “de_DE”.

It is not working.

@a-wendler can you share a link to your GitHub repo?

Hello Caroline, this one worked for me. Locale is now being imported. Anyway I have created a function to use a standard date time and manually add it 3 hours.
Thanks for your help.

1 Like