Amazon Linux 2023 drops Python 2 entirely, breaking scripts on migration
Developers migrating from Amazon Linux 2 to Amazon Linux 2023 are encountering failures because AL2023 does not include Python 2 in any form — not even as an installable package via dnf. Amazon Linux 2 had shipped Python 2.7 by default to support legacy tooling and older cloud-init modules, but AL2023 makes a complete break, offering only Python 3 (3.9 by default, with 3.11 and 3.12 also available). Any script, cron job, systemd unit, or configuration management module that references the python2 or pip2 interpreter will fail immediately upon provisioning on the new AMI. The only supported resolution is porting affected code to Python 3, which involves updating shebangs, replacing explicit python2/pip2 invocations, and addressing language-level differences such as print syntax and unicode handling. Developers are also advised to audit scripts that suppress exit codes, as missing-binary errors may be silently swallowed rather than surfacing as visible failures.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in