0

I am following this tutorial to get playwright installed on a docker container which I am then trying to deploy to an AWS Lambda function: https://tech.smartshopping.co.jp/lambda-container-playwright

After following all of the steps I keep getting the following error:

╔══════════════════════════════════════════════════════╗
║ Host system is missing dependencies to run browsers. ║
║ Missing libraries:                                   ║
║     libasound.so.2                                   ║
╚══════════════════════════════════════════════════════╝

This is my docker file:

FROM public.ecr.aws/lambda/python:3.9-arm64

ENV  PLAYWRIGHT_BROWSERS_PATH=/var/task/bin

RUN yum -y update && yum -y install libXScrnSaver gtk2 gtk3 alsa-lib.x86_64

RUN mkdir /var/task/bin

COPY /app/main.py requirements.txt ./

RUN python3.9 -m pip install --upgrade pip &&  \
    python3.9 -m pip install -r requirements.txt && \
    python3.9 -m playwright install chromium

# Command can be overwritten by providing a different command in the template directly.
CMD ["main.lambda_handler"]

I have tried installing the missing library in the first RUN command changing:

RUN yum -y update && yum -y install libXScrnSaver gtk2 gtk3 alsa-lib.x86_64

to:

RUN yum -y update && yum -y install libXScrnSaver libasound.so.2 gtk2 gtk3 alsa-lib.x86_64

but that just resulted in the same error. so I tried installing the lib in the third RUN command changing:

RUN python3.9 -m pip install --upgrade pip &&  \
    python3.9 -m pip install -r requirements.txt && \
    python3.9 -m playwright install chromium

to:

RUN python3.9 -m pip install --upgrade pip &&  \
    python3.9 -m pip install -r requirements.txt && \
    python3.9 -m playwright install chromium && \
    python3.9 -m pip install libasound.so.2

but that again just resulted in the same error being produced.

How can I install the missing library in order to fix the error?

EDIT:

Fixed by changing this line:

RUN yum -y update && yum -y install libXScrnSaver libxtst6 gtk2 gtk3 alsa-lib.x86_64

to:

RUN yum -y update && yum -y install libXScrnSaver libxtst6 gtk2 gtk3 alsa-lib.aarch64

But now getting the error:

pid=68\n[pid=68][err] 
/var/task/bin/chromium-1005/chrome-linux/chrome: 
/lib64/libm.so.6: version `GLIBC_2.27' not found 
(required by /var/task/bin/chromium-1005/chrome-linux/chrome)\n

[pid=68][err] 
/var/task/bin/chromium-1005/chrome-linux/chrome: 
/lib64/libm.so.6: version `GLIBC_2.29' not found 
(required by /var/task/bin/chromium-1005/chrome-linux/chrome)

1 Answers1

0

Have you tried to download it as Binary package?

Maybe you can go over this libasound.so.2 package page and see if you can download it.

wget https://vault.centos.org/centos/8/AppStream/aarch64/os/Packages/alsa-lib-1.2.5-4.el8.aarch64.rpm

When I searched within apt, ubuntu package tool I don't see anything there

root@21be95fca6e6:/# apt search libasound.so.2
Sorting... Done
Full Text Search... Done

For instance, Vim package would appears like below

root@21be95fca6e6:/# apt search vim           
Sorting... Done
Full Text Search... Done
apvlv/jammy 0.4.0-2 arm64
  PDF viewer with Vim-like behaviour
Haeyoon J.
  • 181
  • 1
  • 2
  • 12
  • No, I did not try this. What are the steps to doing so? Because I just added wget to the first ```RUN``` command and then I added ```wget https://vault.centos.org/centos/8/AppStream/aarch64/os/Packages/alsa-lib-1.2.5-4.el8.aarch64.rpm``` to the third ```RUN``` command and I still got the error. – wannabeprogrammer May 18 '22 at 17:31