Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] install-deps should be more friendly to users of other Linux distros #11122

Closed
Luc45 opened this issue Dec 28, 2021 · 38 comments
Closed

Comments

@Luc45
Copy link

Luc45 commented Dec 28, 2021

Currently, only Ubuntu 18.04 and 20.04 are officially supported by Playwright.

Out of the box on Manjaro, playwright is able to be installed and run a tests both in headless and headed mode:

  1. npm i -D @playwright/test
  2. npx playwright install
  3. npx playwright test

Code under test:

const { test, expect } = require('@playwright/test');

test('basic test', async ({ page }) => {
  await page.goto('https://foo.loc/');
  const title = page.locator('.site-title a');
  await expect(title).toHaveText('Foo Test');
});

It works.

However, when I try to execute the same test with more browsers after specifying chromium, firefox and webkit on playwright.config.js, playwright prompts me to install dependencies:

image

When running npx playwright install-deps, I get:

Installing Ubuntu dependencies...
sh: line 1: apt-get: command not found

The error is clear, it tries to install some package with apt-get, which does not exist in Arch Linux. However, it doesn't tell me which one, so that I can install it on my own.

To get around this, I was trying to figure out what I needed to install on my own. The closest I could get was to this list: https://github.com/microsoft/playwright/blob/d34f9972abf3e412c9a73ee7b524e529a89136f8/packages/playwright-core/src/utils/nativeDeps.ts

But surely I don't need all of that, as the Chromium works out of the box both headless and headed, so there must be some package missing in my environment that I need to install.

My request is that install-deps be specific about what dependencies are missing, so that users of other distros of Linux can have a chance to manually install the dependencies themselves.

@aslushnikov
Copy link
Collaborator

@Luc45 fair enough. Would you like to submit PR to have a more friendly message with the list of packages for non-ubuntu distros?

You'd need to enhance this function:

export async function validateDependenciesLinux(sdkLanguage: string, linuxLddDirectories: string[], dlOpenLibraries: string[]) {

@Luc45
Copy link
Author

Luc45 commented Dec 28, 2021

@Luc45 fair enough. Would you like to submit PR to have a more friendly message with the list of packages for non-ubuntu distros?

You'd need to enhance this function:

export async function validateDependenciesLinux(sdkLanguage: string, linuxLddDirectories: string[], dlOpenLibraries: string[]) {

Thanks for pointing me to the function. I will try, even though JavaScript is a language that I only use on a per-need basis for basic FE. My main languages are PHP and Go. I will poke at it through the end of this week and post and update here if I am able to progress.

PS: By just quickly glancing at the function, it can be pretty simple - a matter of printing the missing dependencies array.

@aslushnikov
Copy link
Collaborator

PS: By just quickly glancing at the function, it can be pretty simple - a matter of printing the missing dependencies array.

Yeah I eye-balled it as well and looks very doable.

@Luc45
Copy link
Author

Luc45 commented Jan 3, 2022

image

I wanted to do something more sophisticated, checking if command -v apt-get returned 0 (apt-get exists) or 1 (does not exist), and displaying a custom message depending on it, but I was spending some time trying to get the command to spawn to retrieve the exit code, and my team decided to keep using Puppeteer for a while longer, so I don't have much time to spend on it.

This covers the "happy path". I haven't changed the "unhappy path", since it already displays the missing dependencies, and the third conditional, the missing libraries, is quite O.S agnostic, so there was no change needed there.

However, trying to install these packages does not solve the issue in Arch Linux:

image

It seems these packages exist with slightly different names in Arch. libicu66 seems to be part of icu, libwepb6 seems to be libwebp, libenchant1c2a is probably enchant.

I can still run the tests with Chromium, though - this affects only my hability to install the other Playwright browsers.

Do you want me to open a PR with the tweaked message above?

@aslushnikov
Copy link
Collaborator

image
Do you want me to open a PR with the tweaked message above?

Let's not. Listing the libraries to install for arch linux is too much of a commitment for us - we'll never keep this list up-to-date since we don't run any of our tests on arch.

Thank you for looking into this though!

@Luc45
Copy link
Author

Luc45 commented Jan 3, 2022

@aslushnikov jfyi, the dependencies list is generated automatically:

 `If you are using a Linux distribution other than Ubuntu, please install the dependencies manually:`,
 ``,
 `${[...missingPackages].join(', ')}`,

@aslushnikov
Copy link
Collaborator

@Luc45 oh, I thought that's a hardcoded list that you suggested there.. My bad!

Still, i wouldn't make the message more scary for general ubuntu users.

@Luc45
Copy link
Author

Luc45 commented Jan 4, 2022

Still, i wouldn't make the message more scary for general ubuntu users.

Agreed. I tried to differentiate Ubuntu user from non-Ubuntu users, but that's a bit tricky with Node out of the box. What I did instead, was checking if apt-get system command existed, and I display the message for Ubuntu/non-Ubuntu based on that. That's what I meant with:

I wanted to do something more sophisticated, checking if command -v apt-get returned 0 (apt-get exists) or 1 (does not exist)

@thevinter
Copy link

I'm also using Arch I am unable to run playwright at the moment because I have no clue what deps I should manually install. At least a list would be great...

@nglgzz
Copy link

nglgzz commented Feb 25, 2022

I finally managed to get playwright to run Chromium, Firefox and Webkit on Arch by installing these packages:

aur/enchant1.6
aur/icu66
aur/libwebp052

As mentioned in this comment #2621 (comment)

@Eeyhan
Copy link

Eeyhan commented Mar 1, 2022

I finally managed to get playwright to run Chromium, Firefox and Webkit on Arch by installing these packages:

aur/enchant1.6 aur/icu66 aur/libwebp052

As mentioned in this comment #2621 (comment)

wow,hi,guys,how to install these lib,my ssytem is centos8,can you help me?

@WinterCore
Copy link

To other people that may run into this issue.

You can run npx playwright install-deps --dry-run to show the underlying apt-get install command which also shows all the dependencies.

Example output:

sudo -- sh -c "apt-get update&& apt-get install -y --no-install-recommends fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libcairo2 libcups2 libdbus-1-3 libdrm2 libegl1 libgbm1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxdamage1 libxext6 libxfixes3 libxrandr2 libxshmfence1 xvfb fonts-noto-color-emoji ttf-unifont libfontconfig libfreetype6 xfonts-cyrillic xfonts-scalable fonts-ipafont-gothic fonts-wqy-zenhei fonts-tlwg-loma-otf ttf-ubuntu-font-family ffmpeg libcairo-gobject2 libdbus-glib-1-2 libfontconfig1 libgdk-pixbuf2.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libxcb-shm0 libxcursor1 libxi6 libxrender1 libxt6 libxtst6 gstreamer1.0-libav gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-plugins-good libenchant1c2a libepoxy0 libevdev2 libgl1 libgles2 libgstreamer-gl1.0-0 libgstreamer1.0-0 libharfbuzz-icu0 libharfbuzz0b libhyphen0 libicu66 libjpeg-turbo8 libnotify4 libopenjp2-7 libopus0 libpng16-16 libsecret-1-0 libsoup2.4-1 libvpx6 libwayland-client0 libwayland-egl1 libwayland-server0 libwebp6 libwebpdemux2 libwoff1 libxkbcommon0 libxml2 libxslt1.1"

@Luc45
Copy link
Author

Luc45 commented Apr 1, 2022

To other people that may run into this issue.

You can run npx playwright install-deps --dry-run to show the underlying apt-get install command which also shows all the dependencies.

Example output:

sudo -- sh -c "apt-get update&& apt-get install -y --no-install-recommends fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libcairo2 libcups2 libdbus-1-3 libdrm2 libegl1 libgbm1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxdamage1 libxext6 libxfixes3 libxrandr2 libxshmfence1 xvfb fonts-noto-color-emoji ttf-unifont libfontconfig libfreetype6 xfonts-cyrillic xfonts-scalable fonts-ipafont-gothic fonts-wqy-zenhei fonts-tlwg-loma-otf ttf-ubuntu-font-family ffmpeg libcairo-gobject2 libdbus-glib-1-2 libfontconfig1 libgdk-pixbuf2.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libxcb-shm0 libxcursor1 libxi6 libxrender1 libxt6 libxtst6 gstreamer1.0-libav gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-plugins-good libenchant1c2a libepoxy0 libevdev2 libgl1 libgles2 libgstreamer-gl1.0-0 libgstreamer1.0-0 libharfbuzz-icu0 libharfbuzz0b libhyphen0 libicu66 libjpeg-turbo8 libnotify4 libopenjp2-7 libopus0 libpng16-16 libsecret-1-0 libsoup2.4-1 libvpx6 libwayland-client0 libwayland-egl1 libwayland-server0 libwebp6 libwebpdemux2 libwoff1 libxkbcommon0 libxml2 libxslt1.1"

I get the same output on Manjaro (Arch Linux). By doing a diff, the only extension that isn't on my end is libxtst6.

It seems a lot of people in this post wants support for Arch, specifically, which is also my exact same need...

@aslushnikov
Copy link
Collaborator

This should be fixed in 1.21 for everybody; the patches are already landed on @playwright/test@next - so please give it a try!

@rhyek
Copy link

rhyek commented Apr 18, 2022

It now errors out with "Error: Unsupported Linux distribution, only Ubuntu is supported!" full stop and --dry-run no longer works, either, therefore we aren't able to at least see the underlying apt-get. Not sure how that constitutes as "fixed". This is worse!

v 1.20.2:

bash-4.2# /.playwright/node/linux/playwright.sh install-deps chromium --dry-run
sh -c "apt-get update&& apt-get install -y --no-install-recommends fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libcairo2 libcups2 libdbus-1-3 libdrm2 libegl1 libgbm1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxdamage1 libxext6 libxfixes3 libxrandr2 libxshmfence1 xvfb fonts-noto-color-emoji ttf-unifont libfontconfig libfreetype6 xfonts-cyrillic xfonts-scalable fonts-ipafont-gothic fonts-wqy-zenhei fonts-tlwg-loma-otf ttf-ubuntu-font-family"
bash-4.2# 

v 1.21

bash-4.2# /.playwright/node/linux/playwright.sh install-deps chromium --dry-run
Failed to install browser dependencies
Error: Unsupported Linux distribution, only Ubuntu is supported!
bash-4.2# %    

@Luc45
Copy link
Author

Luc45 commented Apr 18, 2022

I haven't tried it myself, yet. However, at a minimum, we should be grateful that they are looking at it at all. If you think something is behaving weird, please open another issue @rhyek , and if I might give you a personal tip, remember that you are using this tool for free, and that the developers are doing their best. It's open-source, so you are free (and encouraged) to contribute to solutions and with code yourself, too.

@aslushnikov
Copy link
Collaborator

It now errors out with "Error: Unsupported Linux distribution, only Ubuntu is supported!" full stop and --dry-run no longer works, either, therefore we aren't able to at least see the underlying apt-get. Not sure how that constitutes as "fixed". This is worse!

@rhyek We're sorry - this is fixed and will be released in a patch release 1.21.1 shortly.

@WinterCore
Copy link

@rhyek You're completely right. I don't think this is considered a fix.

But again @Luc45 is right. We can't ask for too much.

I spent like an hour googling every dependency so that I can get its Arch community/aur package, which turned out to be a pain in the ass, so I just gave up and used docker, I think you should consider going with that since it's the only solution for now.

@rhyek
Copy link

rhyek commented Apr 18, 2022

@WinterCore yes, that is what I'm currently trying to do, but that has its own issues unrelated to this project. In my case I am trying to build a container image with awslinux as transitive base to run on AWS Lambda.

@aslushnikov thanks!

@aslushnikov
Copy link
Collaborator

1.21.1 is live - please try it out!

@DCNick3
Copy link

DCNick3 commented Apr 25, 2022

Doesn't seem to be on PyPI yet

@alapanme
Copy link

@aslushnikov Any timelines on when it would be released on PyPI?

@mxschmitt
Copy link
Member

@alapanme we can't guarantee any eta, but probably around a week.

@rsramkis
Copy link

1.21.1 is live - please try it out!

I went ahead and re-tested on EndeavourOS \ Arch Linux with the latest production install.

Arch Linux Repository Dependencies installed:

enchant
icu
libwebp

Both Firefox and Chrome ran all 25 Tests Headed and Headless Successfully.

The Webkit run failed because of missing dependencies:

~/Development/Playwright is 📦 v1.0.0 via  v16.15.0 took 21s
❯ npx playwright test --project=webkit

Running 25 tests using 2 workers
  1) [webkit] › example.spec.js:38:3 › New Todo › should clear text input field when an item is added

    browserType.launch:
    ╔══════════════════════════════════════════════════════╗
    ║ Host system is missing dependencies to run browsers. ║
    ║ Missing libraries:                                   ║
    ║     libpcre.so.3                                     ║
    ║     libicui18n.so.66                                 ║
    ║     libicuuc.so.66                                   ║
    ║     libwebp.so.6                                     ║
    ║     libenchant.so.1                                  ║
    ╚══════════════════════════════════════════════════════╝

It looks like someone testing on Fedora 36 also had Webkit fail. So I will wait to see how that progresses.

#14736

@kalinchernev
Copy link

Still relevant issue. I just started with the official installation guide and got

Installing Playwright Test (npm install --save-dev @playwright/test)…
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN 2@1.0.0 No description
npm WARN 2@1.0.0 No repository field.

+ @playwright/test@1.24.2
added 3 packages from 42 contributors and audited 3 packages in 0.871s
found 0 vulnerabilities

Downloading browsers (npx playwright install --with-deps)…
BEWARE: your OS is not officially supported by Playwright; installing dependencies for Ubuntu as a fallback.
Installing dependencies...
Switching to root user to install dependencies...
[sudo] password for kalin: 
Sorry, try again.
[sudo] password for kalin: 
sh: line 1: apt-get: command not found
Failed to install browsers
Error: Installation process exited with code: 127
Error: Command failed: npx playwright install --with-deps
    at checkExecSyncError (child_process.js:790:11)
    at execSync (child_process.js:863:15)
    at executeCommands (/home/kalin/.npm/_npx/351249/lib/node_modules/create-playwright/lib/index.js:4519:39)
    at Generator.run (/home/kalin/.npm/_npx/351249/lib/node_modules/create-playwright/lib/index.js:4592:5)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async /home/kalin/.npm/_npx/351249/lib/node_modules/create-playwright/lib/index.js:4856:3 {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 351346,
  stdout: null,
  stderr: null
}

OS: Manjaro Linux, it uses AUR, in my case through yay although this is irrelevant.

The bootstrapped package.json contains "@playwright/test": "^1.24.2"

I just installed #11122 (comment) and it will probably help, but issue now is that the init script seems to leave unfinished work as I only have package.json and its lock file, there are no sample files as https://playwright.dev/docs/intro#whats-installed

@slobo
Copy link

slobo commented Oct 22, 2022

I finally managed to get playwright to run Chromium, Firefox and Webkit on Arch by installing these packages:

aur/enchant1.6 aur/icu66 aur/libwebp052

On my machine i also had to

sudo ln -s /usr/lib/libpcre.so /usr/lib/libpcre.so.3

@frascu
Copy link

frascu commented Dec 19, 2022

I finally managed to get playwright to run Chromium, Firefox and Webkit on Arch by installing these packages:
aur/enchant1.6 aur/icu66 aur/libwebp052

On my machine i also had to

sudo ln -s /usr/lib/libpcre.so /usr/lib/libpcre.so.3

For Arch Linux users, I installed also:

aur/libffi7

@rsramkis
Copy link

rsramkis commented Jan 3, 2023

So on Arch Linux there are also the official packages for:

  • enchant
  • icu
  • libwebp
  • libffi

Why not test\use these regularly updated packages? If there is a problem with the older libraries then this could introduce many issues.

Is there an official Playwright list which says which packages they expect us to use?

@olivier-keeper
Copy link

So to get webkit working on Manjaro I add to do the following:

  • yay libwebp052
  • yay icu66
  • yay enchant
  • yay libffi7
  • sudo ln -s /usr/lib/libpcre.so /usr/lib/libpcre.so.3

@SalahAdDin
Copy link

It also adds the dependencies for working with webkit:

sudo pacman -S hyphen enchant harfbuzz-icu woff2
yay -S libffi7 enchant1.6 icu66 libwebp052

sudo ln -s libicui18n.so.67 libicui18n.so.66
sudo ln -s libicuuc.so.67 libicuuc.so.66
sudo ln -s libwebp.so.7 libwebp.so.6
sudo ln -s /usr/lib/libffi /usr/lib/libffi.so.8.1.2
sudo ln -s /usr/lib/libpcre.so /usr/lib/libpcre.so.3

@sdwvit
Copy link

sdwvit commented Feb 11, 2023

whoever is stuck on lts 22.04.1 and playwright reporting unsupported OS, do this:

1. sudo nano /etc/ept/sources.list
2. >> deb http://security.ubuntu.com/ubuntu focal-security main
3. sudo apt update
4. sudo apt install libicu66 libwebp6
5. sudo nano /etc/ept/sources.list
6. << deb http://security.ubuntu.com/ubuntu focal-security main
7. sudo apt update

@rubenesque-code
Copy link

rubenesque-code commented May 5, 2023

So to get webkit working on Manjaro I add to do the following:

  • yay libwebp052
  • yay icu66
  • yay enchant
  • yay libffi7
  • sudo ln -s /usr/lib/libpcre.so /usr/lib/libpcre.so.3

I'm using Manjaro too and did this, though through pamac rather than yay. I'm still getting errors:

Error: browserType.launch:

Host system is missing dependencies to run browsers.
Missing Libraries:
  libflite.so.1
  libflite_usenglish.so.1                         
  libflite_cmulex.so.1                             
  libflite_cmu_us_awb.so.1                         
  libflite_cmu_us_kal.so.1                         
  libflite_cmu_us_rms.so.1                         
  libflite_cmu_us_slt.so.1                         

This seems to only affect webkit. Chromium and Firefox are working fine.

@kevinfiol
Copy link

kevinfiol commented May 18, 2023

whoever is stuck on lts 22.04.1 and playwright reporting unsupported OS, do this:

1. sudo nano /etc/ept/sources.list
2. >> deb http://security.ubuntu.com/ubuntu focal-security main
3. sudo apt update
4. sudo apt install libicu66 libwebp6
5. sudo nano /etc/ept/sources.list
6. << deb http://security.ubuntu.com/ubuntu focal-security main
7. sudo apt update

Thank you, this helped a lot. In my case (on Linux Mint 22) I also wanted to test on Webkit browsers, so I also had to install libffi7.

@yozachar
Copy link

Related ref: #8100 (comment)

@aslushnikov
Copy link
Collaborator

Hey everybody!

There's now an experimental support for all linux distributions using our browser container image mcr.microsoft.com/playwright.
If you can run this container image on your linux distribution, then you can instruct @playwright/test to connect to it and run browsers inside the container.

Please give it a try and let us know what you think here: #26482

@Luc45
Copy link
Author

Luc45 commented Jan 23, 2024

Please give it a try and let us know what you think here: #26482

Browser inside docker = only headless mode 😢 (at least without a VNC)

@SalahAdDin
Copy link

So to get webkit working on Manjaro I add to do the following:

  • yay libwebp052
  • yay icu66
  • yay enchant
  • yay libffi7
  • sudo ln -s /usr/lib/libpcre.so /usr/lib/libpcre.so.3

I'm using Manjaro too and did this, though through pamac rather than yay. I'm still getting errors:

Error: browserType.launch:

Host system is missing dependencies to run browsers.
Missing Libraries:
  libflite.so.1
  libflite_usenglish.so.1                         
  libflite_cmulex.so.1                             
  libflite_cmu_us_awb.so.1                         
  libflite_cmu_us_kal.so.1                         
  libflite_cmu_us_rms.so.1                         
  libflite_cmu_us_slt.so.1                         

This seems to only affect webkit. Chromium and Firefox are working fine.

I found it today.

@alex2awesome
Copy link

I installed all of these dependencies through conda, because I have no access to sudo on my machine. However, playwright isn't detecting any of these files.

Has anyone else tried to make this work with conda?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests