安装pyppeteer遇到问题,大家是怎么解决的?

20 Replies, 2137 Views

Hey guys,

So I was trying to 安装pyppeteer today and ran into some weird errors... like, it keeps saying "Chromium download failed" or something?

I followed the docs but no luck.

Anyone else had this issue? How’d you fix it?

Also, my Python version is 3.8, dunno if that matters.

Tried pip install pyppeteer --upgrade too, still stuck.

Pls help a noob out lol.

Thanks in advance!

(btw, if u know any workarounds for the chromium thing, lmk!)
Chromium download fails are super common with 安装pyppeteer, especially on slower networks.

Try setting the env var before installing:
`PYPPETEER_DOWNLOAD_HOST=https://npm.taobao.org/mirrors pip install pyppeteer`

This uses a mirror in China, way faster. Also, check if your firewall/AV is blocking the download.
Yo, had the same issue last week! Turns out pyppeteer's default chromium version was bugged for me.

Workaround: install chromium separately and point pyppeteer to it:
```
import pyppeteer
pyppeteer.chromium_executable = "/path/to/your/chromium"
```

Saved me hours of headache. GL!
3.8 might actually be the problem lol. Pyppeteer works better with 3.9+.

Try creating a fresh venv with python 3.9 and:
`pip install -U pyppeteer`

If still stuck, this GitHub thread has legit fixes: [insert github pyppeteer issues link]
Bro just use playwright instead. Way more stable than 安装pyppeteer these days.

`pip install playwright
playwright install chromium`

Done. No download errors, better docs, actively maintained. Thank me later.
Had this EXACT error yesterday! Fixed it by:

1. Deleting ~/.pyppeteer folder
2. Running as admin (weird but worked)
3. Using VPN (my ISP was blocking something)

Also try `--trusted-host pypi.org --trusted-host files.pythonhosted.org` with pip
Hey thanks everyone for the suggestions!

Tried the taobao mirror thing and it WORKED (after 3 attempts lol).

Weird that the docs don't mention this - would've saved me 2 days.

Now getting some async errors but at least chromium's there. Might check out playwright like some suggested.

You guys rock!
Pro tip: Skip the headache and use docker.

`docker run -it python:3.8 bash
pip install pyppeteer`

Works every time for me. Containers don't care about your local network issues.
Chromium thing happens when your system misses libs. On Ubuntu/Debian do:

`sudo apt-get install -y gconf-service libasound2... [etc]`

Full list here: [chromium deps docs link]

Also try `export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1` first
Lol welcome to pyppeteer hell. The maintainers basically abandoned it.

Either:
- Use the taobao mirror like others said
- OR download chromium manually from [official chromium link] and set path
- OR switch to playwright (seriously)



Users browsing this thread: 1 Guest(s)