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

ERROR: Double requirement given: wheel>=0.34.2 (already in wheel, name='wheel') #86

Closed
abravalheri opened this issue Aug 3, 2020 · 6 comments
Labels

Comments

@abravalheri
Copy link
Contributor

Hi guys, thank you very much for all the work you have put on this.
I run into an weird error this morning while trying to build a project with pep517, so I tried to recreate a reduced version that demonstrates the error, to report the issue.

It seems that pep517 tries to include wheel in the build environment but does not reconcile the version when the user specifies a range in setup.cfg :: options.setup_requires or pyproject.toml :: build-system.requires.

This is the error message I am having:

ERROR: Double requirement given: wheel>=0.34.2 (already in wheel, name='wheel')
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmp/example/.venv/lib/python3.6/site-packages/pep517/build.py", line 124, in <module>
    main(parser.parse_args())
  File "/tmp/example/.venv/lib/python3.6/site-packages/pep517/build.py", line 120, in main
    build(args.source_dir, dist, args.out_dir)
  File "/tmp/example/.venv/lib/python3.6/site-packages/pep517/build.py", line 88, in build
    _do_build(hooks, env, dist, dest)
  File "/tmp/example/.venv/lib/python3.6/site-packages/pep517/build.py", line 64, in _do_build
    env.pip_install(reqs)
  File "/tmp/example/.venv/lib/python3.6/site-packages/pep517/envbuild.py", line 103, in pip_install
    stderr=LoggerWrapper(log, logging.ERROR),
  File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/tmp/example/.venv/bin/python', '-m', 'pip', 'install', '--ignore-installed', '--prefix', '/tmp/pep517-build-env-24brzdll', 'wheel', 'setuptools_scm>=4.1.2', 'wheel>=0.34.2']' returned non-zero exit status 1.

And these are the files to reproduce the test:

# pyproject.toml
[build-system]
requires = ["setuptools>=46.1.0", "wheel>=0.34.2", "setuptools_scm[toml]>=4.1.2"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
version_scheme = "post-release"
# setup.cfg
[metadata]
name = example
description = example
platforms = any

[options]
zip_safe = False
packages = find:
include_package_data = True
package_dir =
    =src
setup_requires =
    setuptools_scm>=4.1.2
    wheel>=0.34.2

[options.packages.find]
where = src
exclude =
    tests

[bdist_wheel]
universal = 1
# setup.py
from setuptools import setup

if __name__ == "__main__":
    setup(use_scm_version={"version_scheme": "post-release"})
# src/example.py
def main():
    print("hello world")

if __name__ == "__main__":
    main()

After creating the files I did:

git init .
git add .
git commit -a -m "initial commit'
virtualenv .venv
.venv/bin/pip install -U pip setuptools  pep517
.venv/bin/python -m pep517.build .

Please let me know if you need any other information, or if it is more appropriate to report this issue elsewhere.

@finswimmer
Copy link

Hello @abravalheri ,

setuptools declares wheel on it's own as a requirement for building wheel in the build-backend api

So it should not be necessary to declare it in the pyproject.toml.

fin swimmer

@abravalheri
Copy link
Contributor Author

Thank you very much Fin. I will remove it.

Just for my own understanding: does this mean also that any 2 build-time dependencies that declare a repeated requirement will end up causing this error if one of them specifies a version range and the other one doesn't?

@abravalheri
Copy link
Contributor Author

Hi @finswimmer, I removed the wheel requirement in pyproject.toml, but left it in setup.cfg (for backward compatibility) and the error still happens in the same example. Is it expected?

@pradyunsg
Copy link
Member

@abravalheri Don't use setup_requires with pyproject.toml's build-system.requires. The latter is a replacement for setup_requires, which is on-its-way to be phased out. Further, please post the error message if it's not the exact same. :)

@abravalheri
Copy link
Contributor Author

abravalheri commented Aug 4, 2020

Hi @pradyunsg thank you very much for your time in looking at this issue.

I have other question (sorry, so many doubts). If I don't include setup_requires will setuptools read pyproject.toml build-system.requires for editable installs (pip install -e . or python setup.py develop)? (so that I can remove setup_requires without worrying about functionality relying in setuptools_scm will break for editable installs, for example).

(Unfortunately I could not find much information in setuptools docs, even the deprecation of setup_requires I could only found in issue comments, but not in the official docs, that is why my last resource is to ask you guys about this stuff).

@takluyver
Copy link
Member

We've come to an agreement that the functionality to create isolated build environments and install build dependencies will live in the PyPA build project. The pep517 library will continue to exist as the lower-level piece to work with the interfaces defined by PEP 517, but the pep517.envbuild module and the little command-line interfaces which use it (pep517.build, pep517.check and pep517.meta) will gradually be deprecated and eventually removed as build becomes more stable. See #91 for more on that process.

So I'm closing this, as there won't be any further significant work here installing build dependencies. Hopefully build already meets your needs better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants