Categories
Software

Building Wheel for a Python Package Failed

Today I was trying to install frappe-bench package within a newly created python 3 virtual environment in my Ubuntu 20.04. It gave this error in terminal.

ERROR: Command errored out with exit status 1:
command: /home/junaid/python-env/erpnext/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-g6347jx5/python-crontab/setup.py'"'"'; __file__='"'"'/tmp/pip-install-g6347jx5/python-crontab/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-kw47_972
    cwd: /tmp/pip-install-g6347jx5/python-crontab/
Complete output (8 lines):
/usr/lib/python3.8/distutils/dist.py:274: UserWarning: Unknown distribution option: 'release'
warnings.warn(msg)
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
    or: setup.py --help [cmd1 cmd2 ...]
    or: setup.py --help-commands
    or: setup.py cmd --help

error: invalid command 'bdist_wheel'
----------------------------------------
ERROR: Failed building wheel for python-crontab

However, the package appeared to be installed even with above error. Then I got this SO thread in my search https://stackoverflow.com/questions/53204916/what-is-the-meaning-of-failed-building-wheel-for-x-in-pip-install. It has this answer from a pip maintainer briefing about the behavior of pip, so pip was trying to build the wheel before attempting by setup.py install.

Same thread has another answer suggesting to install the wheel package.

pip3 install wheel

I tried it. Then installing python-crontab worked without any errors!