aws / aws-lambda-base-images

Apache License 2.0
670 stars 110 forks source link

unable to execute 'gcc': No such file or directory #25

Closed hw26 closed 2 years ago

hw26 commented 3 years ago

Hi, I was trying to create a docker image for my python script and upload it to AWS ECR and then use it in Lambda. Our python runtime is 3.8 shown on the AWS console so I just followed this manual: https://docs.aws.amazon.com/lambda/latest/dg/images-create.html#images-create-from-base

But I got the error when I rundocker build -t image-name .

6 14.02 gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/var/lang/include/python3.8 -c bitarray/_bitarray.c -o build/temp.linux-x86_64-3.8/bitarray/_bitarray.o

6 14.02 unable to execute 'gcc': No such file or directory

6 14.02 error: command 'gcc' failed with exit status 1

I double checked and I have gcc installed on my macOS:

Warning: gcc 11.2.0 is already installed and up-to-date. To reinstall 11.2.0, run: brew reinstall gcc

Would appreciate some help on resolving this. thanks!

EDIT: This issue originates from me unable to import a CPython library cytoolz when running my script on Lambda, so I consulted these issues: https://github.com/ethereum/web3.py/issues/1456#issuecomment-866862759 https://github.com/Miserlou/Zappa/issues/1717#issuecomment-445821158 To simulate the runtime using docker. If there is a better way to import cytoolz without using docker I would also def appreciate some hints!

Thx!!

alexganwd commented 2 years ago

I ran into the same issue and fixed it by installing the gcc package before pip install RUN yum install gcc -y

smirnoal commented 2 years ago

gcc is not a part of the base image, so it needs to be installed with the command above