What is the meaning of “Failed building wheel for X” in pip install?

后端 未结 12 1057
执念已碎
执念已碎 2020-12-07 13:54

This is a truly popular question here at SO, but none of the many answers I have looked at, clearly explain what this error really mean, and why it occurs.

One sour

12条回答
  •  青春惊慌失措
    2020-12-07 14:18

    (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, you get the "Failed building wheel for pycparser" message and pip falls back to installing directly (via setup.py install).

    Once we have a wheel, pip can install the wheel by unpacking it correctly. pip 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).


    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.)


    The above is the legacy behavior that is currently the default; we'll switch to PEP 517 by default, sometime in the future, moving us to a standards-based process for this. We also have isolated builds for that so, you'd have wheel installed in those environments by default. :)

    • PEP 517: A build-system independent format for source trees
    • A blog post on "PEP 517 and 518 in Plain English"

提交回复
热议问题