Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'wheel' not detected when building wheel for legacy setup.py project #11362

Closed
1 task done
jeffwidman opened this issue Aug 8, 2022 · 11 comments
Closed
1 task done
Labels
state: needs reproducer Need to reproduce issue

Comments

@jeffwidman
Copy link
Contributor

Description

Context including links to CI job logs: dependabot/dependabot-core#5478

The pipfile package doesn't publish a wheel: https://pypi.org/project/pipfile/#files

However, when installing the package, I got the following error message:

Using legacy 'setup.py install' for pipfile, since package 'wheel' is not installed.

This implies that I need to install the wheel package, which is extremely confusing, because I had installed wheel, and other packages were successfully installing wheel.

It took some digging before I realized the problem was that the target package had never published their wheel.

Expected behavior

Please reword the error message to make it clear that the problem is the target package hasn't published a wheel... maybe:

Using legacy 'setup.py install' for pipfile, since pipfile has not published a wheel.

pip version

22.0.4

Python version

3.10.5

OS

Ubuntu 20.04

How to Reproduce

pip install pipfile

Output

No response

Code of Conduct

@uranusjr
Copy link
Member

uranusjr commented Aug 8, 2022

Uh, no, the message is shown exactly because wheel is not detected in your environment. The message would not show simply because the project doesn’t publish a wheel—as long as wheel is detected, pip can build a wheel for you, and the message does not show if that works.

So the question is why wheel is not detected, as you said you have it installed. I cannot reproduce, however:

(pipfile-wheel) $ pip list           
Package    Version
---------- -------
pip        22.2.2
setuptools 63.1.0

(pipfile-wheel) $ pip install pipfile
Collecting pipfile
  Downloading pipfile-0.0.2.tar.gz (18 kB)
  Preparing metadata (setup.py) ... done
Collecting toml
  Using cached toml-0.10.2-py2.py3-none-any.whl (16 kB)
Using legacy 'setup.py install' for pipfile, since package 'wheel' is not installed.
Installing collected packages: toml, pipfile
  Running setup.py install for pipfile ... done
Successfully installed pipfile-0.0.2 toml-0.10.2

(pipfile-wheel) $ pip uninstall pipfile -qy
(pipfile-wheel) $ pip install wheel
Collecting wheel
  Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Installing collected packages: wheel
Successfully installed wheel-0.37.1

(pipfile-wheel) $ pip install pipfile      
Collecting pipfile
  Using cached pipfile-0.0.2.tar.gz (18 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: toml in ./pipfile-wheel/lib/python3.10/site-packages (from pipfile) (0.10.2)
Building wheels for collected packages: pipfile
  Building wheel for pipfile (setup.py) ... done
  Created wheel for pipfile: filename=pipfile-0.0.2-py2.py3-none-any.whl size=11935 sha256=f0ecbd8da568039947d6a9d490f265522a4d406c39307e00155aff030ecfedce
  Stored in directory: $cache/pip/wheels/dc/12/fd/239c6cbb5f6d58d4707486ba5be928188ab7ce33f804a14785
Successfully built pipfile
Installing collected packages: pipfile
Successfully installed pipfile-0.0.2

@uranusjr uranusjr changed the title Confusing error message when package doesn't publish a wheel 'wheel' not detected when building wheel for legacy setup.py project Aug 8, 2022
@uranusjr uranusjr added state: needs reproducer Need to reproduce issue and removed type: bug A confirmed bug or unintended behavior S: needs triage Issues/PRs that need to be triaged labels Aug 8, 2022
@pradyunsg
Copy link
Member

And this isn’t because the package didn’t publish a wheel — it could be why pip tried to generate a wheel, but the fatal issue from pip’s perspective is that the package cannot be built without the wheel package being installed.

@jeffwidman
Copy link
Contributor Author

Uh, no, the message is shown exactly because wheel is not detected in your environment. The message would not show simply because the project doesn’t publish a wheel—as long as wheel is detected, pip can build a wheel for you, and the message does not show if that works.

Oh interesting, I misunderstood wheels then. I though wheel had to be installed in order for pip to even be able to download wheels in the first place. And since we were successfully downloading wheels for other packages, that meant wheel was installed. Thanks for educating me.

Currently wheel is installed as part of the list of packages that installs pipfile, so that would explain why this is failing. But if we install it first, then install everything else, this succeeds.

Closing since this was my error, however a quick clarification question: If pipfile starts publishing a wheel to PyPI, will this error disappear (at least for the pipfile case)?

@jeffwidman jeffwidman closed this as not planned Won't fix, can't repro, duplicate, stale Aug 8, 2022
@uranusjr
Copy link
Member

uranusjr commented Aug 9, 2022

The main misunderstanding here was that wheel is not for installing wheels, but for building wheels. So if a project starts publishing wheels, pip can install those directly without needing to build anything, so yes, you wouldn’t see the message in that case.

@jeffwidman
Copy link
Contributor Author

Thanks @uranusjr !

@sbidoul
Copy link
Member

sbidoul commented Aug 9, 2022

Note this warning is being turned into a deprecation in #11331. If a better formulation can be found, now is a good time.

@jeffwidman
Copy link
Contributor Author

Thanks @sbidoul for the heads up. But IIUC, as long as we explicitly install wheel first, then pip will skip the deprecation notice since it can successfully build the wheel locally...

If I misunderstand, please correct me.

@sbidoul
Copy link
Member

sbidoul commented Aug 10, 2022

Yes that is correct.

@jeffwidman
Copy link
Contributor Author

As pointed out in dependabot/dependabot-core#5587, it appears that rather than explicitly manually install wheel first, we can instead just pass the --pep-517 flag to pip and it will dynamically install wheel iff needed.

I'm planning to merge that fix into Dependabot, but if for some reason this is a bad idea, please comment on that PR.

@pradyunsg
Copy link
Member

That's a valid solution as well, yes.

That might interact weirdly with certain redistributions of Python, such as the one that Debian ships (but IIUC, dependabot doesn't use the Debian-provided Python, so it should be fine). +

@jeffwidman
Copy link
Contributor Author

Thanks @pradyunsg !

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
state: needs reproducer Need to reproduce issue
Projects
None yet
Development

No branches or pull requests

4 participants