Home > other >  No module named amazon_linux_extras when running amazon-linux-extras install epel -y
No module named amazon_linux_extras when running amazon-linux-extras install epel -y

Time:07-21

Here is my (simplified) Dockerfile

# https://docs.aws.amazon.com/lambda/latest/dg/images-create.html#images-create-from-base
FROM public.ecr.aws/lambda/python:3.8

# get the amazon linux extras
RUN yum install -y amazon-linux-extras

RUN amazon-linux-extras install epel -y

When it reaches the RUN amazon-linux-extras install epel -y line during the build, it gets

Step 6/8 : RUN amazon-linux-extras install epel -y
 ---> Running in dbb44f57111a
/var/lang/bin/python: No module named amazon_linux_extras
The command '/bin/sh -c amazon-linux-extras install epel -y' returned a non-zero code: 1

I think that has to do with some python 2 vs. 3 stuff, but I'm not sure

CodePudding user response:

You're correct, it's because amazon-linux-extras only works with Python 2. You can modify the RUN instruction to RUN PYTHON=python2 amazon-linux-extras install epel -y

  • Related