Bench init frappe Failed building wheel for Pillow Failed building wheel for lxml

After getting psycopg2 issue out of the way, I’m once more stuck with error, this time with the pip packages Pillow and lxml:

$ bench init frappe
INFO:bench.utils:virtualenv -q env -p /usr/bin/python
Already using interpreter /usr/bin/python
INFO:bench.utils:env/bin/pip -q install --upgrade pip
INFO:bench.utils:env/bin/pip -q install wheel
INFO:bench.utils:env/bin/pip -q install six
INFO:bench.utils:env/bin/pip -q install -e git+ app frappe
INFO:bench.utils:git clone   --origin upstream
Cloning into 'frappe'...
remote: Enumerating objects: 52, done.
remote: Counting objects: 100% (52/52), done.
remote: Compressing objects: 100% (49/49), done.
remote: Total 160689 (delta 11), reused 16 (delta 3), pack-reused 160637
Receiving objects: 100% (160689/160689), 178.98 MiB | 1.21 MiB/s, done.
Resolving deltas: 100% (122269/122269), done.
Checking out files: 100% (2291/2291), done.
('installing', u'frappe') frappe
INFO:bench.utils:frappe/env/bin/pip install -q  -e frappe/apps/frappe 
  Failed building wheel for Pillow
  Failed building wheel for lxml
Command "/home/frappe/frappe/env/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-AneHUg/Pillow/';f=getattr(tokenize, 'open', open)(__file__);'\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-qQ63Y3/install-record.txt --single-version-externally-managed --compile --install-headers /home/frappe/frappe/env/include/site/python2.7/Pillow" failed with error code 1 in /tmp/pip-install-AneHUg/Pillow/                                      
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
  File "/usr/local/lib/python2.7/dist-packages/bench/", line 40, in cli
  File "/usr/local/lib/python2.7/dist-packages/click/", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/bench/commands/", line 30, in init
    python               = python)
  File "/usr/local/lib/python2.7/dist-packages/bench/", line 75, in init
    get_app(frappe_path, branch=frappe_branch, bench_path=path, build_asset_files=False, verbose=verbose)
  File "/usr/local/lib/python2.7/dist-packages/bench/", line 135, in get_app
    install_app(app=app_name, bench_path=bench_path, verbose=verbose)
  File "/usr/local/lib/python2.7/dist-packages/bench/", line 179, in install_app
  File "/usr/local/lib/python2.7/dist-packages/bench/", line 159, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: frappe/env/bin/pip install -q  -e frappe/apps/frappe 

For context, I’m doing a manual install on a debootsrap’d Debian system.

  • apt dependencies I’ve installed so far from distro repo: git build-essential python-setuptools python-dev libffi-dev libpq-dev libssl nginx mariadb-server-10.3 redis-server xfonts-75dpi xfonts-base
  • nodejs from its repository, and npm yarn
  • pip -e bench from git repo

As it turns out, it was because OS library dependencies of Pillow and lxml wasn’t installed. Installing dependencies specified by their respective documentations solve the issue.