Error when trying to create PDF

Hi ,

we’re encountering the following error when trying to create PDF of documents

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 67, in application
    response = frappe.api.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 53, in handle
    return frappe.handler.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 22, in handle
    data = execute_cmd(cmd)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 53, in execute_cmd
    return, **frappe.form_dict)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 939, in call
    return fn(*args, **newargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/", line 48, in download_pdf
    frappe.local.response.filecontent = get_pdf(html)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/", line 14, in get_pdf
    html, options = prepare_options(html, options)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/", line 71, in prepare_options
    html, html_options = read_options_from_html(html)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/", line 86, in read_options_from_html
    soup = BeautifulSoup(html, "html5lib")
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/bs4/", line 198, in __init__
    % ",".join(features))
FeatureNotFound: Couldn't find a tree builder with the features you requested: html5lib. Do you need to install a parser library?

Any idea how to solve this please?

Many thanks

Still hoping for some assistance here…


I solved this by updating the pdf library.

This is what I got from my bash_history file. Perhaps it may help you.

wkhtmltopdf --version
cd /opt/
tar vxf wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
ls -l
cp wkhtmltox/bin/wk* /usr/local/bin/
wkhtmltopdf --version

Hi @crafter

Thanks a lot for your response. Checking the wkhtmltopdf version shows the following wkhtmltopdf 0.12.3 (with patched qt)

Do I still need to update?

I would try it. If I recall. the issue was about some missing library that was preventing the PDF render. I cannot recall the details or the error message, but installing as described fixed the PDF issue for me. I had to restart the service, I also recall.

Hi @crafter

I uninstalled and reinstalled wkhtmltopdf but still getting the same error. What service exactly did you restart and how did you do it?


I have exactly the same issue.
Fresh Ubuntu 16.04 server install followed by fresh ERPnext-Production Easy install on a local PC.
I log in without problem, everything seems to work until I try printing a PDF.
Can somebody help Please?

So it’s not a unique issue. We are also experiencing this on a fresh install. Ubuntu 16.04 using the easy install script. Could any member of the core team look into this and maybe offer a workaround?


Hi @jpkuhn

Here’s how I got around the issue:

Usually, the html5lib directory is available at the following locations

  1. /usr/local/lib/python2.7/dist-packages/pip/_vendor/html5lib
  2. /home/frappe/frappe-bench/env/lib/python2.7/site-packages/pip/_vendor/html5lib
  3. /home/frappe/frappe-bench/env/lib/python2.7/site-packages/html5lib

I however observed that the folder was missing from the 3rd location so I copied it over using the command below

cp /home/frappe/frappe-bench/env/lib/python2.7/site-packages/pip/_vendor/html5lib/. /home/frappe/frappe-bench/env/lib/python2.7/site-packages/html5lib

I followed this with a bench update

Now the PDF feature is working. I created a Github issue and hopefully this will soon be addressed by the core team

Kind regards,