What Is the Meaning of "Failed Building Wheel for X" in Pip Install

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

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.

What is the meaning of Building wheel for xxx when I use pip install package?

I am assuming you have already caught up with documentation on:

  • The Wheel Packaging format and what the .whl file contains
  • Building a .whl file
  • Installing from Pypi

Running pip install allennlp with -vvv offers more insights related to your specific question:

Created temporary directory: /private/var/folders/kh/1cpkyp_535jg856yrdnql0rw0000gn/T/pip-install-leyfrduz

...

Created temporary directory: /private/var/folders/kh/1cpkyp_535jg856yrdnql0rw0000gn/T/pip-wheel-s1uhiijv
Building wheel for jsonnet (setup.py) ... Destination directory: /private/var/folders/kh/1cpkyp_535jg856yrdnql0rw0000gn/T/pip-wheel-s1uhiijv
Running command /Users/subhashb/.pyenv/versions/3.7.2/envs/test-env-dev/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/kh/1cpkyp_535jg856yrdnql0rw0000gn/T/pip-install-leyfrduz/jsonnet/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 /private/var/folders/kh/1cpkyp_535jg856yrdnql0rw0000gn/T/pip-wheel-s1uhiijv --python-tag cp37
running bdist_wheel
running build
running build_ext
c++ -c -g -O3 -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json core/desugarer.cpp -o core/desugarer.o
core/desugarer.cpp:406:67: warning: unused parameter 'obj_level' [-Wunused-parameter]
AST* makeArrayComprehension(ArrayComprehension *ast, unsigned obj_level) {

...

writing manifest file 'jsonnet.egg-info/SOURCES.txt'
Copying jsonnet.egg-info to build/bdist.macosx-10.14-x86_64/wheel/jsonnet-0.12.1-py3.7.egg-info
running install_scripts
adding license file "LICENSE" (matched pattern "LICEN[CS]E*")
creating build/bdist.macosx-10.14-x86_64/wheel/jsonnet-0.12.1.dist-info/WHEEL
creating '/private/var/folders/kh/1cpkyp_535jg856yrdnql0rw0000gn/T/pip-wheel-s1uhiijv/jsonnet-0.12.1-cp37-cp37m-macosx_10_14_x86_64.whl' and adding 'build/bdist.macosx-10.14-x86_64/wheel' to it
adding '_jsonnet.cpython-37m-darwin.so'
adding 'jsonnet-0.12.1.dist-info/LICENSE'
adding 'jsonnet-0.12.1.dist-info/METADATA'
adding 'jsonnet-0.12.1.dist-info/WHEEL'
adding 'jsonnet-0.12.1.dist-info/top_level.txt'
adding 'jsonnet-0.12.1.dist-info/RECORD'
removing build/bdist.macosx-10.14-x86_64/wheel
done

The pip package code that makes this beautiful process run is at github. And it eventually ends up making a call to jsonnet's Makefile to "build" the wheel

In short, picking the example of jsonnet, running pip install jsonnet does the following:

  • downloads the jsonnet.tar.gz to a local temporary folder
  • invokes a c++ command to compile .cpp files
  • builds _jsonnet.cpython-37m-darwin.so (which is the correct library format for my Mac OS machine)
  • records the wheel distribution info in jsonnet-0.12.1.dist-info (typically present in your virtual env)

This flow is for jsonnet, and it happens to be slightly complicated because jsonnet is ultimatly a C extension. But regular python packages will just have the source file(s) downloaded and installed in the virtualenv. You can walk the same path to understand what happens behind any package.

Building wheel for pyscard (setup.py): finished with status 'error'

I added into .readthedocs.yml:

build:
apt_packages:
- swig
- pcscd
- libpcsclite-dev

Could not build wheels for _ which use PEP 517 and cannot be installed directly - Easy Solution

The easiest solution to deal with the error

"Could not build wheels for ____ which use PEP 517 and cannot be installed directly" 

is the following:

sudo pip3 install _____ --no-binary :all:

Where ____ is obviously the name of the library you want to install.



Related Topics



Leave a reply



Submit