Skip to content

Specifying --use-pep517 to a non-pyproject.toml project should populate build requirements #9523

Closed
@jaraco

Description

@jaraco

Environment

  • pip version: 21
  • Python version: 3.8
  • OS: macOS 11

Description

Attempting to download a project that depends on termcolor~=1.1.0 fails to build the metadata for termcolor if setuptools isn't implicitly installed, even with pep517 enabled.

In order to wean myself from implicit setuptools, I've left setuptools uninstalled from my environment, and instead rely on passing --use-pep517 to invoke the "fallback to setuptools" behavior for packages not supplying pyproject.toml. Downloading just termcolor by itself works without error, but attempting to download a project that depends on termcolor (such as tensorflow) will fail to build the metadata for termcolor. It seems that the pep517 fallback to setuptools behavior doesn't take effect in the download command.

Expected behavior

Passing --use-pep517 to pip should enable the fallback to setuptools behavior (and make it available for a project if the build dependencies aren't specified in pyproject.toml).

How to Reproduce

$ python3.8 -m pip download --use-pep517 tensorflow
Collecting tensorflow
  Using cached tensorflow-2.4.1-cp38-cp38-macosx_10_11_x86_64.whl (173.9 MB)
Collecting termcolor~=1.1.0
  Using cached termcolor-1.1.0.tar.gz (3.9 kB)
    ERROR: Command errored out with exit status 1:
     command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-download-78dnfhfc/termcolor_3986fcda2fa34e69b903950f54c7bcc5/setup.py'"'"'; __file__='"'"'/private/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-download-78dnfhfc/termcolor_3986fcda2fa34e69b903950f54c7bcc5/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-pip-egg-info-38q33ums
         cwd: /private/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-download-78dnfhfc/termcolor_3986fcda2fa34e69b903950f54c7bcc5/
    Complete output (3 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ModuleNotFoundError: No module named 'setuptools'
Collecting tensorflow
...
<proceeds to download every version of tensorflow>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions