aws / aws/aws-lambda-python-runtime-interface-client

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

Offen
#90 5 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
294
Forks
84
Ø Merge
3 T. 7 Min.
Gemergte PRs (30 T.)
3

Beschreibung

Hi,

I am trying to create a docker containers that will run on lambda but I continuously get the error: [Unable to import module 'app': No module named '_tkinter'", "errorType": "Runtime.ImportModuleError" on running the container.

I am sharing the my Dockerfile below:

```base
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
RUN mkdir -p ./fonts/
RUN curl -LJO https://raw.githubusercontent.com/airctic/storage/master/SpaceGrotesk-Medium.ttf
RUN cp SpaceGrotesk-Medium.ttf ./fonts/
RUN yum install -y tkinter tcl-devel tk-devel
COPY model_dir ./model_dir
COPY /app/app.py ./
CMD ["app.handler"]
```

The requirements.txt:

```base
--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
```

The tkinter package is a basic package in python and hence required but even after installing it is not able to find the package. I logged in to the docker container using the below:

```base
docker exec -it sh
```
Then I logged into the python shell and ran:

```base
>>> import tkinter
Traceback (most recent call last):
File "", line 1, in
File "/var/lang/lib/python3.8/tkinter/__init__.py", line 36, in
import _tkinter # If this fails your Python may not be configured for Tk
ModuleNotFoundError: No module named '_tkinter'
```

I ran the following in the python shell:

```base
import subprocess
subprocess.call(['pip', 'install', 'tk'])
```

I also ran the following to install tkinter:

```base
yum install -y tkinter
yum install -y python3-tkinter
```
Nothing seems to work and looks like the was lambda python runtime needs to have this package to run python smoothly. Can someone please suggest?

Warm Regards
Ganesh Bhat

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.