question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pip's error message for wheel-build failure on PEP517 packages isn't very friendly

See original GitHub issue

Environment

  • pip version: 19.0.2
  • Python version:
Python 2.7.13 (ab0b9caf307db6592905a80b8faffd69b39005b8, Sep 30 2018, 13:49:36)
[PyPy 6.0.0 with GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.2)]
  • OS: macOS

Description When pip fails to build a wheel, a fairly cryptic message appears for someone not “intimately” aware of the Python packaging ecosystem:

(The below is with cryptography, which does not publish macOS wheels for PyPy, but should fail the same way for any similar failure).

⊙  pypy ~/Development/virtualenv/virtualenv.py venv && venv/bin/pip install --quiet cryptography                                                                                                                                       jberman@USNYHJBERMANMB2
New pypy executable in /Users/jberman/Desktop/venv/bin/pypy
Installing setuptools, pip, wheel...done.
DEPRECATION: A future version of pip will drop support for Python 2.7.
/Users/jberman/Desktop/venv/site-packages/pip/_vendor/msgpack/fallback.py:222: PendingDeprecationWarning: encoding is deprecated, Use raw=False instead.
  PendingDeprecationWarning)
  Failed building wheel for cryptography
Could not build wheels for cryptography which use PEP 517 and cannot be installed directly

I wouldn’t expect a random Python developer to know what PEP517 is (today?) in isolation. The error message appears to just be a way of saying “building the wheel failed, for reasons like e.g. not being able to find OpenSSL in this specific case, but more generically the compiler or some other thing in the build toolchain exiting unsuccessfully”.

These appear to be the relevant pip source lines.

Expected behavior Ideally an error message that could be understood in isolation would be nice – I can’t tell immediately the specific set of things that need to happen to trigger that branch in the code, but my best guess at the minute would be something like `Building a <foo> wheel failed. See above for details of the specific error. Refusing to attempt an sdist build because <foo> uses features present only in PEP517. See <documentation on PEP517> for details and <foo’s setup.py presumably, ideally with some specific info on what feature it uses?> for specifics."

FWIW the old version of this error was not any more friendly. On pip 18.x:

Command "/Users/jberman/Desktop/venv/bin/pypy -u -c "import setuptools, tokenize;__file__='/private/var/folders/46/1d5dl2sn5n9b0f3pd8lbvz9hhr5mnp/T/pip-install-96YFMf/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/46/1d5dl2sn5n9b0f3pd8lbvz9hhr5mnp/T/pip-record-kUXGwh/install-record.txt --single-version-externally-managed --compile --install-headers /Users/jberman/Desktop/venv/include/site/python2.7/cryptography" failed with error code 1 in /private/var/folders/46/1d5dl2sn5n9b0f3pd8lbvz9hhr5mnp/T/pip-install-96YFMf/cryptography/

which is close to gibberish, but I guess I was conditioned to tune out that line and just focus on the one above it that says building the wheel failed – but ideally if the error message is changing, would be nice to show something that could help the person seeing it to know what to do.

How to Reproduce / Output (See above shell line)

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:7
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Juliancommented, Mar 30, 2020

My experience is that what’s before it generally is relevant, and is what needs looking at, though is certainly cryptic and error specific – but that those are facts more relevant to the state of compilers than of anything Python related. What you get is the huge dump of errors coming from a C compiler or worse, and yeah, reading them is not easy.

Given the opposite experience though perhaps we can discuss specific examples (perhaps your specific build output?), and maybe in a separate ticket?

I assume you don’t disagree with:

  • pip should show the output of what it was trying to do untouched
  • pip when failing should not reference PEPs, and should instead describe what it was running when referencing that output in simpler terms that are as actionable as possible

and that ideally

  • pip should provide hints when it knows specific areas in the output that should be looked at, based on some interior knowledge of what was being tried

(So personally I think the issue of this ticket is precisely that message and not beyond it)

0reactions
callegarcommented, Mar 30, 2020

The problem is not really with that message. The problem is that what is provided before that message is most of the time totally irrelevant.

For instance, if on my system I try pip install --force-reinstall --no-binary :all: numpy, then that fails with the infamous ERROR: Could not build wheels for numpy which use PEP 517 and cannot be installed directly. Before that, I see that the install fails precisely at the Building wheel for numpy (PEP 517) phase.

Pip tries to provide Complete output. That on my system is a good 369 lines. Not a single one containing the word “error” or an indication that something is not found. No indication whatsoever of what the building of the wheel implied (calling external programs? invoking the linker?).

Any hint at how to know what pip (or possibly setuptools) is trying to achieve before erroring out?

Read more comments on GitHub >

github_iconTop Results From Across the Web

PEP 517 and projects that can't install via wheels - Packaging
I think it's be important to make the message clear: pip will still be able to install from sdists, but it will do...
Read more >
Could not build wheels for _ which use PEP 517 and ...
The easiest solution to deal with the error "Could not build wheels for ____ which use PEP 517 and cannot be installed directly"....
Read more >
How to Publish an Open-Source Python Package to PyPI
PEP 517 describes how a build backend should work. ... The error message says that the standard library's urllib package hasn't defined a ......
Read more >
History - setuptools 65.6.3.post20221216 documentation
#2608: Added informative error message to PEP 517 build failures owing to an ... package under setuptools when pip isn't available or otherwise...
Read more >
Could not build wheels for PyGObject which use PEP 517 and ...
Ubuntu 18.04, pip is 20.02. I supposedly installed via Ubuntu instructions but it doesnt work(cant import on python) Pip installation gives the error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found