jupyter-book
jupyter-book copied to clipboard
Navigation Timeout error when building book pdf
Describe the bug
context
I was able to build the book pdf with pyppeteer in the past, but now it throws pyppeteer.errors.TimeoutError: Navigation Timeout Exceeded: 30000 ms exceeded.
I could not find a solution on the pyppeteer repo. I am not sure if this is a JupyterBook or pyppeteer issue.
$ jupyter-book build . --builder pdfhtml
Reproduce the bug
$ jupyter-book build . --builder pdfhtml
List your environment
Jupyter Book : 0.12.3 External ToC : 0.2.3 MyST-Parser : 0.15.2 MyST-NB : 0.13.2 Sphinx Book Theme : 0.1.9 Jupyter-Cache : 0.4.3 NbClient : 0.5.13
I'm running into the same problem when trying to build the book at https://github.com/xpqz/learnapl
This was with v13.0
of Jupyter Book and v1.0.3
of pyppeteer. I seemed to have fixed the problem by simply editing line 50 of pdf.py
from
await page.goto(f"file:///{html_file}", {"waitUntil": ["networkidle2"]})
to
await page.goto(f"file:///{html_file}", {"timeout": 0, "waitUntil": ["networkidle2"]})
I'm not intimately familiar with the internal workings of Jupyter Book, or with pyppeteer so I'm not sure if this is a "good" fix or not. Would appreciate it if a core contributor can find the bandwidth to take a look at this.
Nice fix @anrddh. Solved issue for me!
Commenting just so I get updates on this issue :)
This was with
v13.0
of Jupyter Book andv1.0.3
of pyppeteer. I seemed to have fixed the problem by simply editing line 50 ofpdf.py
fromawait page.goto(f"file:///{html_file}", {"waitUntil": ["networkidle2"]})
to
await page.goto(f"file:///{html_file}", {"timeout": 0, "waitUntil": ["networkidle2"]})
I'm not intimately familiar with the internal workings of Jupyter Book, or with pyppeteer so I'm not sure if this is a "good" fix or not. Would appreciate it if a core contributor can find the bandwidth to take a look at this.
May I ask where is the file is so I can try to circumvent this issue. Many thinks in advance.
May I ask where is the file is so I can try to circumvent this issue. Many thinks in advance.
@kwccoin If you're like me and don't know where exactly the package is installed, you can do the following from Python:
import jupyter_book.pdf
jupyter_book.pdf.__file__
> '/opt/homebrew/lib/python3.11/site-packages/jupyter_book/pdf.py'
Thanks! It work now. But I guess it might need an option in the config file, otherwise we have to change it everytime we upgrade our systems. But it works and hence once again many many thanks.