Issue with browser version for playwright

28 views
Skip to first unread message

Sean Fitzpatrick

unread,
Jul 25, 2023, 9:26:51 PM7/25/23
to PreTeXt support
I am trying to build a book with a GeoGebra interactive, so the CLI needs to call playwright for the preview.

I installed playwright via pip (pipx, since I'm on Ubuntu), and then ran 'playwright install'.

In .cache/ms-playwright I can see chromium-1048 and chromium-1071, but when I run pretext build, I see the message "Looks like Playwright was just installed or updated. Please run the following command to download new browsers: playwright install"

I've run this command, and running it again does nothing. I am getting the error:

playwright._impl._api_types.Error: Executable doesn't exist at /home/sean/.cache/ms-playwright/chromium-1067/chrome-linux/chrome

So it is insisting on using a version of chromium that it won't install. Is there a way to specify the chromium version, or to install the one it wants?

D. Brian Walton

unread,
Jul 26, 2023, 12:06:12 AM7/26/23
to pretext-support
Not entirely sure how one would Dennis this, but that sounds like two different versions of playwright are in existence. I've read that each version of playwright is tied to a specific version of chromium. Your description sounds like internal to pretext there is one version and when you run the playwright install it is using a different version.

These are just hunches.  Good luck resolving the issue.

Brian

--
You received this message because you are subscribed to the Google Groups "PreTeXt support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/591ccbf7-e509-4833-9381-2c8d0ff4134an%40googlegroups.com.

Sean Fitzpatrick

unread,
Jul 26, 2023, 12:41:34 AM7/26/23
to pretext...@googlegroups.com
This could be due to the fact that Ubuntu no longer allows global pip installs.
The pipx command makes a virtual environment behind the scenes, but it's presumably different for each install.

I don't think playwright was installed with pretext, or at least, it was missing the first time I tried to use it.

Maybe I have to manually create a virtual environment for everything.

Oscar Levin

unread,
Jul 26, 2023, 2:36:48 PM7/26/23
to pretext...@googlegroups.com
When you pipx install pretext, it should install a version of playwright in pretext's virtual environment.  If you are using the CLI, it should automatically run `playwright install` to get the browsers.  It likely also will try `playwright install-deps` which would try to install linux-required libraries, but those should pass through after the first time.

Is the message from pretext about installing playwright coming from the cli or from core pretext (I think the latter).

Sean Fitzpatrick

unread,
Jul 26, 2023, 6:32:45 PM7/26/23
to PreTeXt support
I will try uninstalling and reinstalling pretext (aka the CLI). I don't think playwright was correctly installed, because the first time I tried to build something with an interactive in it, the build failed because playwright was missing.

Sean Fitzpatrick

unread,
Jul 30, 2023, 11:23:51 AM7/30/23
to PreTeXt support
It's possible that the problem is that playwright wants to install a version of Chromium that isn't available in Ubuntu 23.04.
When I run pretext on a project with an interactive, playwright runs, and then tries to install software via the Ubuntu repositories.
It then seems to fail.

Sean Fitzpatrick

unread,
Jul 30, 2023, 11:36:37 AM7/30/23
to PreTeXt support
OK, I figured it out. Sort of.

When pretext is installed via pipx, it's placed in a virtual environment, and playwright is installed as a dependency. It ends up in the bin folder of the virtual environment.
Playwright itself is not added to the path.

I don't really know why things fail when playwright tries to install things on the fly during a pretext build.

But ahead of time, you can find where pipx put the virtual environment and open the bin folder where playwright lives (for me, this is ~/.local/pipx/venvs/pretext/bin).
Apparently pipx is set up with permissions that do not allow me to manually activate the venv.
But in that folder, I was able to do './playwright install' to install the necessary browsers, and now everything works fine.

Reply all
Reply to author
Forward
0 new messages