You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug/missing-packages with locale configuration in the AWS Lambda Python 3.12 runtime Docker images
Steps to reproduce:
✅ Working Condition:
Use a Python 3.10 image, then build and run your dockerfile as below:
# any of these 3.10 images workFROM public.ecr.aws/lambda/python:3.10.2025.01.15.17-x86_64
# FROM public.ecr.aws/lambda/python:3.10.2025.01.15.17-arm64ENTRYPOINT ["python", "-c", "\import locale; \print('Before setting locales:', locale.getlocale()); \locale.setlocale(locale.LC_ALL, 'en_US.UTF-8'); \print('After setting to en_US.UTF-8:', locale.getlocale()); \locale.setlocale(locale.LC_ALL, 'es_ES.UTF-8'); \print('After setting to es_ES.UTF-8:', locale.getlocale())"]
Run in your terminal:
docker build -t test.&& docker run --rm test
Note the output:
Before setting locales: ('en_US', 'UTF-8')
After setting to en_US.UTF-8: ('en_US', 'UTF-8')
After setting to es_ES.UTF-8: ('es_ES', 'UTF-8')
❌ Broken Condition:
Replicate the above but use a Python 3.12 image.
Either:
FROM public.ecr.aws/lambda/python:3.12.2025.01.24.11-x86_64
or
FROM public.ecr.aws/lambda/python:3.12.2025.01.24.11-arm64
Observe the error output stating the locale setting is unsupported.
Traceback (most recent call last):
File "<string>", line 1, in<module>
File "/var/lang/lib/python3.12/locale.py", line 615, in setlocale
return _setlocale(category, locale)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
locale.Error: unsupported locale setting
Before setting locales: ('C', 'UTF-8')
🩹 This can be addressed by modifying the Dockerfile so that your final Dockerfile looks like:
# these 3.12 images only work if I include the RUN and ENV lines belowFROM public.ecr.aws/lambda/python:3.12.2025.01.24.11-x86_64
# FROM public.ecr.aws/lambda/python:3.12.2025.01.24.11-arm64RUN dnf install -y glibc-langpack-en glibc-langpack-es && dnf clean all
ENTRYPOINT ["python", "-c", "\import locale; \print('Before setting locales:', locale.getlocale()); \locale.setlocale(locale.LC_ALL, 'en_US.UTF-8'); \print('After setting to en_US.UTF-8:', locale.getlocale()); \locale.setlocale(locale.LC_ALL, 'es_ES.UTF-8'); \print('After setting to es_ES.UTF-8:', locale.getlocale())"]
satisfactory output:
Before setting locales: ('en_US', 'UTF-8')
After setting to en_US.UTF-8: ('en_US', 'UTF-8')
After setting to es_ES.UTF-8: ('es_ES', 'UTF-8')
⚠️ Is there a known issue with locale configuration in the AWS Lambda Python 3.12 runtime images❓
The text was updated successfully, but these errors were encountered:
Description:
Bug/missing-packages with locale configuration in the AWS Lambda Python 3.12 runtime Docker images
Steps to reproduce:
✅ Working Condition:
Use a Python 3.10 image, then build and run your dockerfile as below:
Run in your terminal:
Note the output:
❌ Broken Condition:
Replicate the above but use a Python 3.12 image.
Either:
or
Observe the error output stating the locale setting is unsupported.
🩹 This can be addressed by modifying the Dockerfile so that your final Dockerfile looks like:
satisfactory output:
The text was updated successfully, but these errors were encountered: