'error: subprocess-exited-with-error × Running setup.py install for lru-dict did not run successfully
I am trying to build a container image with AWS EC2 Ubuntu to push on AWS ECR Repository for a python script which needs the web3.py library. However, it is throwing me an error that I'm not sure how to fix. I am using AWS ECR push commands to do it.
The command is: docker build -t docker-lambda
.
My Dockerfile:
FROM public.ecr.aws/lambda/python:3.8
COPY requirements.txt ./
RUN pip3 install -r requirements.txt
COPY app.py ./
CMD ["app.lambda_handler"]
requirements.txt:
web3
Error message:
error: subprocess-exited-with-error
× Running setup.py install for lru-dict did not run successfully.
│ exit code: 1
╰─> [9 lines of output]
running install
running build
running build_ext
building 'lru' extension
creating build
creating build/temp.linux-x86_64-3.8
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/var/lang/include/python3.8 -c lru.c -o build/temp.linux-x86_64-3.8/lru.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> lru-dict
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Solution 1:[1]
Building this lru-dict requires some c packages and libraries. Install gcc tools:
sudo apt-get install build-essential
along with python-tools for dev:
sudo apt-get install python3-dev
try them inside container too....this should work
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | abinash_269 |