0
votes

I am using a python module that uses playwright in my heroku flask app. The installation instructions for the module require that I install the browser binaries like:

python -m playwright install

While when I deploy it locally it works, I seem unable to incorporate the browser binary installation in the deployment. I have tried to use the heroku playwright buildpack instead (https://github.com/mxschmitt/heroku-playwright-buildpack), but this doesn't seem to work, and I get an error like:

2020-11-17T23:06:42.252585+00:00 app[web.1]: "webkit" browser was not found.
2020-11-17T23:06:42.252585+00:00 app[web.1]: Please complete Playwright installation via running
2020-11-17T23:06:42.252585+00:00 app[web.1]: 
2020-11-17T23:06:42.252586+00:00 app[web.1]:     "python -m playwright install"

I also tried manually adding the python -m playwright install command in a buildpack, but this does not work either. Is there any way to install the binaries properly using playwright in heroku?

2

2 Answers

0
votes

Heroku doesn't support webkit at the time, with other browsers, you can use this buildpack: https://github.com/mxschmitt/heroku-playwright-buildpack/

0
votes

What worked for me as a workaround, and I am 100% sure it is not the right solution is to add this to my python code:

from subprocess import Popen, PIPE

p = Popen([sys.executable, "-m", "playwright", "install"], stdin=PIPE, stdout=PIPE, stderr=PIPE)
#output, err = p.communicate()
#print(output)