aws / aws-lambda-base-images

Apache License 2.0
669 stars 110 forks source link

Unable to import module 'app': No module named '_tkinter'", "errorType": "Runtime.ImportModuleError" #70

Closed ganesh3 closed 1 year ago

ganesh3 commented 1 year ago

Hi,

I am building a docker container with Python 3.8 but I constantly get the error for _tkinter package which is required by 'pillow' which is dependency for torchvision among other packages.

The dockerfile is as below.

FROM public.ecr.aws/lambda/python:3.8
RUN yum -y update
RUN yum -y install gcc
RUN yum install -y gcc-c++
RUN yum install -y git
RUN yum install -y which
COPY requirements.txt ./requirements.txt
RUN pip install -r requirements.txt \
    && pip install -e git+https://github.com/ganesh3/icevision.git@master#egg=icevision[inference] --upgrade -q
COPY model_dir ./model_dir
COPY /app/app.py   ./
CMD ["app.handler"] 

The requirements.txt file is as below.

--find-links  https://download.pytorch.org/whl/torch_stable.html
torch==1.10.0+cpu 
torchvision==0.11.1+cpu
--find-links  https://download.openmmlab.com/mmcv/dist/cpu/torch1.10.0/index.html
mmcv-full==1.3.17
mmdet==2.17.0
numpy
Pillow
tk

Is there any issue for tkinter package with the python 3.8 version for AWS lambda? If yes, can this be resolved in any manner?

Please note, I have also tried to install tkinter in the Dockerfile but I still end up with the same error.

Warm Regards Ganesh Bhat

jtuliani commented 1 year ago

Hi @ganesh3. The Lambda team are unable to provide support or answer questions on individual cases via Github issues. For specific questions, please contact AWS customer support.

If you have identified a defect with a Lambda runtime or container image, or have a suggestion, please do feel free to file a Github issue.