What is the meaning of "Failed building wheel for X" in pip install?
Yesterday, I got the same error: Failed building wheel for hddfancontrol
when I ran pip3 install hddfancontrol
. The result was Failed to build hddfancontrol
. The cause was error: invalid command 'bdist_wheel'
and Running setup.py bdist_wheel for hddfancontrol ... error
. The error was fixed by running the following:
pip3 install wheel
(From here.)
Alternatively, the "wheel" can be downloaded directly from here. When downloaded, it can be installed by running the following:
pip3 install "/the/file_path/to/wheel-0.32.3-py2.py3-none-any.whl"
Since, nobody seem to mention this apart myself. My own solution to the above problem is most often to make sure to disable the cached copy by using: pip install <package> --no-cache-dir
.
(pip maintainer here!)
If the package is not a wheel, pip tries to build a wheel for it (via setup.py bdist_wheel
). If that fails for any reason (like, missing system level libraries, incompatibilities with your system, bad version string in the built wheel, etc), you get the "Failed building wheel for {...}" message.
In some of these cases, currently, pip falls back to installing via setup.py install
, so it's possible that the installation still succeeds. That said, pip always tries to install packages via wheels as often as it can. This is because of various advantages of using wheels (like faster installs, cache-able, not executing code again etc) and the fact that it is a standardizd format; unlike the (deprecated) setup.py install interface.
Your error message here is due to the wheel
package being missing, which contains the logic required to build the wheels in setup.py bdist_wheel
. (pip install wheel
can fix that -- but it won't fix any build time issues due to system configuration)
Sometime in the future, we'll switch to a more modern build system by default (if you're a package author, you can opt-in by adding a pyproject.toml
) that will solve this issue, through isolated build environments where you will have wheel installed. :)
- PEP 517: A build-system independent format for source trees
- A blog post on "PEP 517 and 518 in Plain English"