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

pip-compile failure pep517/in_process/_in_process.py get_requires_for_build_wheel #1603

Closed
jeremy-coulon opened this issue Mar 25, 2022 · 38 comments

Comments

@jeremy-coulon
Copy link

jeremy-coulon commented Mar 25, 2022

My pip-compile was working fine yesterday and is now failing.

I don't know what changed. I know that my requirements.txt did not change and my pip-tools version did not change either.

I have seen issues #1535 and #1390 but no workaround works for me.

Environment Versions

  1. OS Type: Linux
  2. Python version: Python 3.8.10
  3. pip version: pip 21.3.1
  4. pip-tools version: pip-compile, version 6.4.0

Steps to replicate

$ cat setup.py
from setuptools import setup


setup(
    name='apollo',
    install_requires=['conan==1.45.0']
    )
$ cat build/requirements.txt
bottle==0.12.19
    # via conan
certifi==2021.10.8
    # via requests
charset-normalizer==2.0.12
    # via requests
colorama==0.4.4
    # via conan
conan==1.45.0
    # via apollo (setup.py)
distro==1.6.0
    # via conan
fasteners==0.17.3
    # via conan
idna==3.3
    # via requests
jinja2==3.0.3
    # via conan
markupsafe==2.1.0
    # via jinja2
node-semver==0.6.1
    # via conan
patch-ng==1.17.4
    # via conan
pluginbase==1.0.1
    # via conan
pygments==2.11.2
    # via conan
pyjwt==1.7.1
    # via conan
python-dateutil==2.8.2
    # via conan
pyyaml==5.4.1
    # via conan
requests==2.27.1
    # via conan
six==1.16.0
    # via
    #   conan
    #   python-dateutil
tqdm==4.62.3
    # via conan
urllib3==1.26.8
    # via
    #   conan
    #   requests

Expected result

success

Actual result

$ pip-compile --output-file build/requirements.txt
ERROR: WARNING: You are using pip version 21.3.1; however, version 22.0.4 is available.
ERROR: You should consider upgrading via the '/data/homes/jcoulon/.gradle/pyvenv-apollo/bin/python -m pip install --upgrade pip' command.
Traceback (most recent call last):
  File "/data/homes/jcoulon/.gradle/pyvenv-apollo/bin/pip-compile", line 8, in <module>
    sys.exit(cli())
  File "/data/homes/jcoulon/.gradle/pyvenv-apollo/lib/python3.8/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/data/homes/jcoulon/.gradle/pyvenv-apollo/lib/python3.8/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/data/homes/jcoulon/.gradle/pyvenv-apollo/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/data/homes/jcoulon/.gradle/pyvenv-apollo/lib/python3.8/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/data/homes/jcoulon/.gradle/pyvenv-apollo/lib/python3.8/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/data/homes/jcoulon/.gradle/pyvenv-apollo/lib/python3.8/site-packages/piptools/scripts/compile.py", line 408, in cli
    dist = meta.load(os.path.dirname(os.path.abspath(src_file)))
  File "/data/homes/jcoulon/.gradle/pyvenv-apollo/lib/python3.8/site-packages/pep517/meta.py", line 71, in load
    path = Path(build_as_zip(builder))
  File "/data/homes/jcoulon/.gradle/pyvenv-apollo/lib/python3.8/site-packages/pep517/meta.py", line 58, in build_as_zip
    builder(dest=out_dir)
  File "/data/homes/jcoulon/.gradle/pyvenv-apollo/lib/python3.8/site-packages/pep517/meta.py", line 53, in build
    _prep_meta(hooks, env, dest)
  File "/data/homes/jcoulon/.gradle/pyvenv-apollo/lib/python3.8/site-packages/pep517/meta.py", line 28, in _prep_meta
    reqs = hooks.get_requires_for_build_wheel({})
  File "/data/homes/jcoulon/.gradle/pyvenv-apollo/lib/python3.8/site-packages/pep517/wrappers.py", line 172, in get_requires_for_build_wheel
    return self._call_hook('get_requires_for_build_wheel', {
  File "/data/homes/jcoulon/.gradle/pyvenv-apollo/lib/python3.8/site-packages/pep517/wrappers.py", line 322, in _call_hook
    self._subprocess_runner(
  File "/data/homes/jcoulon/.gradle/pyvenv-apollo/lib/python3.8/site-packages/pep517/wrappers.py", line 75, in quiet_subprocess_runner
    check_output(cmd, cwd=cwd, env=env, stderr=STDOUT)
  File "/usr/lib/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/data/homes/jcoulon/.gradle/pyvenv-apollo/bin/python', '/data/homes/jcoulon/.gradle/pyvenv-apollo/lib/python3.8/site-packages/pep517/in_process/_in_process.py', 'get_requires_for_build_wheel', '/tmp/tmpr0u030tn']' returned non-zero exit status 1.
@AndydeCleyre

This comment was marked as outdated.

@jeremy-coulon

This comment was marked as outdated.

@AndydeCleyre
Copy link
Contributor

FWIW I can neither reproduce with the current versions of pip-tools and pip, nor those specified. I am testing with Python 3.9.7.

Do you happen to be running on a non-x86_64 platform?

@jeremy-coulon
Copy link
Author

jeremy-coulon commented Mar 25, 2022 via email

@AndydeCleyre
Copy link
Contributor

AndydeCleyre commented Mar 25, 2022

Does installing with pip alone succeed?

@deepyaman
Copy link

We are having the same issue/error message in a project internal to my company, also working fine up until yesterday. @AndydeCleyre installing with pip alone succeeds in my case.

@AndydeCleyre

This comment was marked as outdated.

@matteius
Copy link

A similar issue is affecting the pipenv builds and even though we no longer depend on pip-tools, it broke around the same time that the new setuptools package was released. I've got several hours in trying to actually pin setuptools or determine if that is really the cause or just a coincidence, but it broke for versions of pipenv that have been released since last November. We now only get one entry in the Pipfile.lock for this test case, whereas the expected result has several dependencies in it. Its kind of obscure, and I can share more details if it would be helpful.

@AndydeCleyre
Copy link
Contributor

Can anyone experiencing this create a reproducible case in a container? Like

$ podman run -it --rm docker://python:latest bash
# mkdir ~/proj
# cd ~/proj
# echo -e "from setuptools import setup\n\nsetup(name='apollo', install_requires=['conan==1.45.0'])" >setup.py
# pip install -U pip pip-tools setuptools
# pip-compile

@matteius
Copy link

@AndydeCleyre Leaving docker out of the equation on my end. So far I in my debugging I am comparing the output of invoking the pipenv resolver in 2021.5.29 vs current versions (which worked up until a few days ago), and what I find is:

When I run python ~/pipenv/pipenv/resolver.py . -v inside the checked out repository directory pep508-package, which is correct with both new and old versions.

[{"version": "1.16.0", "hashes": ["sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926", "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"], "name": "six", "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'"}, {"path": ".", "version": "==1.0.0", "name": "pep508-package"}, {"subdirectory": "parent_folder/sibling_package", "ref": "4f7b2b05e0c99d79ece1e8cfe5411a0e5a478648", "git": "https://github.com/techalchemy/test-project.git", "name": "sibling-package"}]

Now when I run: python ~/pipenv/pipenv/resolver.py "git+https://github.com/techalchemy/test-project.git@master#egg=pep508_package&subdirectory=parent_folder/pep508-package" -v

I get this much reduced output that is not correct, this is what the Pipfile.lock get based on:

[{"subdirectory": "parent_folder/pep508-package", "ref": "4f7b2b05e0c99d79ece1e8cfe5411a0e5a478648", "git": "https://github.com/techalchemy/test-project.git", "version": "", "name": "pep508-package"}]

Now I downgrade to pipenv 2021.5.29 and re-run:
python ~/pipenv/pipenv/resolver.py "git+https://github.com/techalchemy/test-project.git@master#egg=pep508_package&subdirectory=parent_folder/pep508-package" -v

[{"version": "0.10.2", "hashes": ["sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b", "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"], "name": "toml", "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'"}, {"version": "1.16.0", "hashes": ["sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926", "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"], "name": "six", "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'"}, {"version": "1.26.9", "hashes": ["sha256:44ece4d53fb1706f667c9bd1c648f5469a2ec925fcf3a776667042d645472c14", "sha256:aabaf16477806a5e1dd19aa41f8c2b7950dd3c746362d7e3223dbe6de6ac448e"], "name": "urllib3", "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'"}, {"subdirectory": "parent_folder/sibling_package", "ref": "4f7b2b05e0c99d79ece1e8cfe5411a0e5a478648", "git": "https://github.com/techalchemy/test-project.git", "name": "sibling-package"}, {"version": "0.10.2", "hashes": ["sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b", "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"], "name": "toml", "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'"}, {"version": "1.16.0", "hashes": ["sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926", "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"], "name": "six", "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'"}, {"version": "1.26.9", "hashes": ["sha256:44ece4d53fb1706f667c9bd1c648f5469a2ec925fcf3a776667042d645472c14", "sha256:aabaf16477806a5e1dd19aa41f8c2b7950dd3c746362d7e3223dbe6de6ac448e"], "name": "urllib3", "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'"}, {"subdirectory": "parent_folder/pep508-package", "ref": "4f7b2b05e0c99d79ece1e8cfe5411a0e5a478648", "git": "https://github.com/techalchemy/test-project.git", "version": "", "name": "pep508-package"}, {"subdirectory": "parent_folder/sibling_package", "ref": "4f7b2b05e0c99d79ece1e8cfe5411a0e5a478648", "git": "https://github.com/techalchemy/test-project.git", "version": "", "name": "sibling-package"}]

So the issue I am experiencing seems to be specifically when the git repository is supplied (but not if it is manually cloned before hand), the pip resolver doesn't resolve all of the dependencies anymore. The weird thing is I have an old setuptools installed for my test and it doesn't matter, but I think maybe pip itself is pulling in the latest setuptools in the resolver ... I've tried pinning it in various places within pip internals to no avail, so maybe its something else entirely?

@matteius
Copy link

So I will leave my feedback on what I found out with regards to pipenv and this issue, it was within our vendor requirementslib that it did not pass the subdirectory to VCS where the setup.py and setup.cfg files are and the new version of setuptools seems to behave differently with respect to building the wheel if its not given the exact directory where the setup.py lives. My theory is it used to find that directory but I am not really sure. You can see what I did with with requiremetntslib patch is to amend the directory passed to build_pep517
https://github.com/pypa/pipenv/pull/5017/files#diff-096b4ab90a8d575dbb56e99f91b0ad743de89a9d482067f4985690e515009328R1233-R1241

It may be possible that any of my comments don't pertain to your issue and if so feel free to minimize any of them. I do find it interesting though the timing of setuptools release, and these two bug reports both concerning pep517 things for two projects that may do things in similar ways. Good luck!

@jeremy-coulon
Copy link
Author

Does installing with pip alone succeed?

Yes

@jeremy-coulon
Copy link
Author

Can you also try with a clean venv?

I tried. Same behavior.

@matteius
Copy link

@jeremy-coulon Not sure what version of virtualenv you have installed, but FWIW it brings in a specific version of setuptools and there was a new version of virtualenv released on March 25th which uses the newer setuptools 61.x

@jeremy-coulon
Copy link
Author

$ pip list
Package       Version
------------- -------
click         8.0.4
pep517        0.12.0
pip           21.3.1
pip-tools     6.4.0
pkg_resources 0.0.0
setuptools    44.0.0
tomli         2.0.1
wheel         0.37.1
WARNING: You are using pip version 21.3.1; however, version 22.0.4 is available.
You should consider upgrading via the '/data/homes/jcoulon/.gradle/pyvenv-apollo/bin/python -m pip install --upgrade pip' command.

I am not sure which version of virtualenv I am using. It is coming from Ubuntu 20.04 packages.

@jeremy-coulon
Copy link
Author

FYI I am creating my virtual env with:

$ python3 -m venv ~/.gradle/pyvenv-apollo
$ source ~/.gradle/pyvenv-apollo/bin/activate
$ pip install wheel "pip-tools<6.5" "pip>=21.2,<22"

I am still confused of differences between venv and virtualenv.

$ aptitude show python3-virtualenv
Package: python3-virtualenv
Version: 20.0.17-1ubuntu0.4
State: installed
Automatically installed: yes
Priority: optional
Section: universe/python
Maintainer: Ubuntu Developers <[email protected]>
Architecture: all
Uncompressed Size: 364 k
Depends: python-pip-whl (>= 20.0.2-5ubuntu1.2~), python3-distutils, python3-pkg-resources, python3-importlib-metadata, python3-appdirs, python3-distlib, python3-filelock, python3-six,
         python3:any
Breaks: virtualenv (< 20.0.10)
Replaces: virtualenv (< 20.0.10)
Description: Python virtual environment creator
 The virtualenv utility creates virtual Python instances, each invokable with its own Python executable.  Each instance can have different sets of modules, installable via easy_install.
 Virtual Python instances can also be created without root access.

 This is the Python 3 version of the library.  It includes the command line script.
Homepage: https://pypi.python.org/pypi/virtualenv

$ aptitude show python3.8-venv
Package: python3.8-venv
Version: 3.8.10-0ubuntu1~20.04.4
State: installed
Automatically installed: yes
Multi-Arch: allowed
Priority: optional
Section: universe/python
Maintainer: Ubuntu Core Developers <[email protected]>
Architecture: amd64
Uncompressed Size: 27,6 k
Depends: python3.8 (= 3.8.10-0ubuntu1~20.04.4), python-pip-whl (>= 8.1.0-2), python3.8-distutils
Conflicts: python3.8-venv:i386
Breaks: python3-pip (< 1.5.6-4)
Provides: python3.8-venv:any (= 3.8.10-0ubuntu1~20.04.4)
Description: Interactive high-level object-oriented language (pyvenv binary, version 3.8)
 Python is a high-level, interactive, object-oriented language. Its 3.8 version includes an extensive class library with lots of goodies for network programming, system administration,
 sounds and graphics.

 This package contains the pyvenv-3.8 binary.

@jeremy-coulon
Copy link
Author

Here is a reproducible Dockerfile:

FROM ubuntu:20.04

RUN apt-get update && apt-get -y install python3-venv
RUN python3 -m venv myvenv
RUN myvenv/bin/pip install wheel "pip-tools<6.5" "pip>=21.2,<22"
RUN echo -e "from setuptools import setup\n\nsetup(name='apollo', install_requires=['conan==1.45.0'])" > setup.py
RUN myvenv/bin/pip-compile

@AndydeCleyre

This comment was marked as outdated.

@matteius

This comment was marked as outdated.

@AndydeCleyre

This comment was marked as outdated.

@matteius
Copy link

@AndydeCleyre Can you try before the echo to print the version of setuptools in both cases? I wonder if they are the same or different between the passing and failing examples.

python -c "import setuptools; print(setuptools.__version__)"

@AndydeCleyre
Copy link
Contributor

AndydeCleyre commented Mar 28, 2022

@AndydeCleyre Could have to do with how you are invoking pip, since the Dockerfile version invokes it from the venv.

The interactive podman example is also using pip from the venv, having activated it for the current shell.

@AndydeCleyre Can you try before the echo to print the version of setuptools in both cases? I wonder if they are the same or different between the passing and failing examples.

python -c "import setuptools; print(setuptools.__version__)"

Both report 44.0.0, but some comments at pypa/setuptools#3198 suggest we may not be able to count on that...

@matteius
Copy link

@AndydeCleyre 44.0.0 is pretty old and there is a new version of wheel recently, I wonder if they aren't compatible since you pip install wheel openly. Perhaps try upgrading setuptools in your test. pip install setuptools --upgrade before you invoke the other pip-compile

@AndydeCleyre
Copy link
Contributor

@matteius I took the latest-posted Dockerfile and updated the installation command to

RUN . ./myvenv/bin/activate && pip install -U wheel "pip-tools<6.5" "pip>=21.2,<22" setuptools

This installed setuptools 61.2.0, but the build still fails the same way.

@AndydeCleyre
Copy link
Contributor

AndydeCleyre commented Mar 28, 2022

This Dockerfile succeeds (!):

FROM ubuntu:20.04

RUN mkdir -p /proj
WORKDIR /proj

RUN printf '%s\n\n' 'from setuptools import setup' 'setup(name="apollo", install_requires=["conan==1.45.0"])' >setup.py

RUN apt -yqq update && apt -yqq install python3-venv

RUN python3 -m venv /proj/venv
RUN . /proj/venv/bin/activate && pip install -U wheel "pip-tools<6.5" "pip>=21.2,<22"
RUN . /proj/venv/bin/activate && pip list
RUN . /proj/venv/bin/activate && pip-compile

The only difference in the versions displayed by pip list there from the above is click 8.1.0, but I doubt that's relevant.

@fpatz
Copy link

fpatz commented Mar 29, 2022

Hint: I've just had the same problem, and found this issue. For me the root cause was that my project was not installable at all (i.e. pip install -e . failed). Fixing that, pip-tools worked just fine.

@AndydeCleyre
Copy link
Contributor

AndydeCleyre commented Mar 29, 2022

@fpatz What kind of change did you need to make?


Minimized, outdated

OK here I'm going to try to investigate what the significant difference might be between this failing Dockerfile:

FROM ubuntu:20.04

RUN apt-get update && apt-get -y install python3-venv
RUN python3 -m venv myvenv
RUN . ./myvenv/bin/activate && pip install wheel "pip-tools<6.5" "pip>=21.2,<22"
RUN echo -e "from setuptools import setup\n\nsetup(name='apollo', install_requires=['conan==1.45.0'])" > setup.py
RUN . ./myvenv/bin/activate && pip-compile

And this succeeding Dockerfile:

FROM ubuntu:20.04

RUN mkdir -p /proj
WORKDIR /proj

RUN printf '%s\n\n' 'from setuptools import setup' 'setup(name="apollo", install_requires=["conan==1.45.0"])' >setup.py

RUN apt -yqq update && apt -yqq install python3-venv

RUN python3 -m venv /proj/venv
RUN . /proj/venv/bin/activate && pip install -U wheel "pip-tools<6.5" "pip>=21.2,<22"
RUN . /proj/venv/bin/activate && pip list
RUN . /proj/venv/bin/activate && pip-compile

I'll do it by incrementally changing the failing Dockerfile into the succeeding one.

Tested Dockerfile variants (folded)

apt rather than apt-get:

FROM ubuntu:20.04

RUN apt -yqq update && apt -yqq install python3-venv

RUN python3 -m venv myvenv
RUN . ./myvenv/bin/activate && pip install wheel "pip-tools<6.5" "pip>=21.2,<22"
RUN echo -e "from setuptools import setup\n\nsetup(name='apollo', install_requires=['conan==1.45.0'])" > setup.py
RUN . ./myvenv/bin/activate && pip-compile

Result: FAIL

make and use /proj as working folder:

FROM ubuntu:20.04

RUN mkdir -p /proj
WORKDIR /proj

RUN apt -yqq update && apt -yqq install python3-venv

RUN python3 -m venv myvenv
RUN . ./myvenv/bin/activate && pip install wheel "pip-tools<6.5" "pip>=21.2,<22"
RUN echo -e "from setuptools import setup\n\nsetup(name='apollo', install_requires=['conan==1.45.0'])" > setup.py
RUN . ./myvenv/bin/activate && pip-compile

Result: FAIL

use absolute paths:

FROM ubuntu:20.04

RUN mkdir -p /proj
WORKDIR /proj

RUN apt -yqq update && apt -yqq install python3-venv

RUN python3 -m venv /proj/myvenv
RUN . /proj/myvenv/bin/activate && pip install wheel "pip-tools<6.5" "pip>=21.2,<22"
RUN echo -e "from setuptools import setup\n\nsetup(name='apollo', install_requires=['conan==1.45.0'])" >/proj/setup.py
RUN . /proj/myvenv/bin/activate && pip-compile

Result: FAIL

printf rather than echo:

FROM ubuntu:20.04

RUN mkdir -p /proj
WORKDIR /proj

RUN apt -yqq update && apt -yqq install python3-venv

RUN python3 -m venv /proj/myvenv
RUN . /proj/myvenv/bin/activate && pip install wheel "pip-tools<6.5" "pip>=21.2,<22"
RUN printf '%s\n\n' 'from setuptools import setup' 'setup(name="apollo", install_requires=["conan==1.45.0"])' >/proj/setup.py
RUN . /proj/myvenv/bin/activate && pip-compile

Result: SUCCESS

Hmmm, so here's a full diff between one that recreates the failure, and one that succeeds:

--- almost/Dockerfile
+++ Dockerfile
@@ -1,12 +1,12 @@
 FROM ubuntu:20.04
 
 RUN mkdir -p /proj
 WORKDIR /proj
 
 RUN apt -yqq update && apt -yqq install python3-venv
 
 RUN python3 -m venv /proj/myvenv
 RUN . /proj/myvenv/bin/activate && pip install wheel "pip-tools<6.5" "pip>=21.2,<22"
-RUN echo -e "from setuptools import setup\n\nsetup(name='apollo', install_requires=['conan==1.45.0'])" >/proj/setup.py
+RUN printf '%s\n\n' 'from setuptools import setup' 'setup(name="apollo", install_requires=["conan==1.45.0"])' >/proj/setup.py
 RUN . /proj/myvenv/bin/activate && pip-compile

Huh, it looks like the echo command is starting the file with a literal -e, so the first line is (broken): -e from setuptools import setup

@AndydeCleyre
Copy link
Contributor

AndydeCleyre commented Mar 29, 2022

So based on @fpatz's comment and my discovery about the unexpected literal -e when using echo in the Dockerfile, it is looking like probably an invalid package/setup.py.

@jeremy-coulon Can you provide a reproduction in a container with a definitely valid package/setup.py?

If it seems valid on your end, in addition to pasting it here, maybe also attach, and include an md5sum?

EDIT: I suspect it's also important to house the setup.py in its own folder.

@AndydeCleyre AndydeCleyre added the needs reproduce Need to reproduce an issue label Mar 29, 2022
@fpatz
Copy link

fpatz commented Mar 29, 2022

@AndydeCleyre what I wrote was unrelated to the reproducer here; I simply botched my own project’s setup.py and got the same traceback, which led me here. That situation deserves a nicer error message, I’d guess. I’ll see if I can prepare a PR for the case of a a bad setup.

@AndydeCleyre AndydeCleyre removed the needs reproduce Need to reproduce an issue label Mar 30, 2022
@AndydeCleyre
Copy link
Contributor

AndydeCleyre commented Mar 30, 2022

Currently on my local machine, in master, running pytest yields four failures, all with similar errors (at get_requires_for_build_wheel). The tests are:

test_cli_compile.py::test_input_formats[setup.py]
test_cli_compile.py::test_multiple_extras[setup.py-singular]
test_cli_compile.py::test_one_extra[setup.py]
test_cli_compile.py::test_multiple_extras[setup.py-comma-separated]
Python package versions
[
  {
    "name": "asttokens",
    "version": "2.0.5"
  },
  {
    "name": "attrs",
    "version": "21.4.0"
  },
  {
    "name": "backcall",
    "version": "0.2.0"
  },
  {
    "name": "cheap-repr",
    "version": "0.5.1"
  },
  {
    "name": "click",
    "version": "8.1.0"
  },
  {
    "name": "coverage",
    "version": "6.3.2"
  },
  {
    "name": "decorator",
    "version": "5.1.1"
  },
  {
    "name": "distlib",
    "version": "0.3.4"
  },
  {
    "name": "execnet",
    "version": "1.9.0"
  },
  {
    "name": "executing",
    "version": "0.8.3"
  },
  {
    "name": "filelock",
    "version": "3.6.0"
  },
  {
    "name": "iniconfig",
    "version": "1.1.1"
  },
  {
    "name": "ipython",
    "version": "8.2.0"
  },
  {
    "name": "jedi",
    "version": "0.18.1"
  },
  {
    "name": "matplotlib-inline",
    "version": "0.1.3"
  },
  {
    "name": "packaging",
    "version": "21.3"
  },
  {
    "name": "parso",
    "version": "0.8.3"
  },
  {
    "name": "pep517",
    "version": "0.12.0"
  },
  {
    "name": "pexpect",
    "version": "4.8.0"
  },
  {
    "name": "pickleshare",
    "version": "0.7.5"
  },
  {
    "name": "pip",
    "version": "22.0.4"
  },
  {
    "name": "pip-tools",
    "version": "6.5.2.dev3+g43e532c",
    "editable_project_location": "/home/andy/Code/pip-tools"
  },
  {
    "name": "pkg_resources",
    "version": "0.0.0"
  },
  {
    "name": "platformdirs",
    "version": "2.5.1"
  },
  {
    "name": "pluggy",
    "version": "1.0.0"
  },
  {
    "name": "plumbum",
    "version": "1.7.2"
  },
  {
    "name": "prompt-toolkit",
    "version": "3.0.28"
  },
  {
    "name": "ptyprocess",
    "version": "0.7.0"
  },
  {
    "name": "pure-eval",
    "version": "0.2.2"
  },
  {
    "name": "py",
    "version": "1.11.0"
  },
  {
    "name": "Pygments",
    "version": "2.11.2"
  },
  {
    "name": "pyparsing",
    "version": "3.0.7"
  },
  {
    "name": "pytest",
    "version": "7.1.1"
  },
  {
    "name": "pytest-cov",
    "version": "3.0.0"
  },
  {
    "name": "pytest-forked",
    "version": "1.4.0"
  },
  {
    "name": "pytest-rerunfailures",
    "version": "10.2"
  },
  {
    "name": "pytest-xdist",
    "version": "2.5.0"
  },
  {
    "name": "setuptools",
    "version": "44.1.1"
  },
  {
    "name": "six",
    "version": "1.16.0"
  },
  {
    "name": "snoop",
    "version": "0.4.1"
  },
  {
    "name": "stack-data",
    "version": "0.2.0"
  },
  {
    "name": "toml",
    "version": "0.10.2"
  },
  {
    "name": "tomli",
    "version": "2.0.1"
  },
  {
    "name": "tox",
    "version": "3.24.5"
  },
  {
    "name": "traitlets",
    "version": "5.1.1"
  },
  {
    "name": "virtualenv",
    "version": "20.14.0"
  },
  {
    "name": "wcwidth",
    "version": "0.2.5"
  },
  {
    "name": "wheel",
    "version": "0.37.1"
  }
]

and also tested with setuptools 61.2.0.

@AndydeCleyre
Copy link
Contributor

AndydeCleyre commented Mar 30, 2022

Ah, our scheduled CI jobs began sharing these failures 5 days ago.

EDIT: I'm catching up with discussion from pypa/pyproject-hooks#116 (comment)

@abravalheri
Copy link
Contributor

abravalheri commented Mar 30, 2022

Hi guys, I will try to have a look this evening on the failing jobs, but it would be really helpful from the setuptools point of view if you have an isolated reproducer.

In terms of potential points of failure, v61 introduced a breaking change for "empty packages". They are now required to explicitly set packages=[] or py_modules=[] in setup.py or the equivalent packages = # purposefully empty in setup.cfg. If this condition is not met and the project root is not empty1, the build can potentially fail.

The first reproduction with Dockerfile that fail in this thread did not met this new requirement. The following revision of the Dockerfile creates a brand new empty project root and simply adds setup.py to it and therefore succeds.

Footnotes

  1. "Empty" with the exception of setup.py, setup.cfg.

@jeremy-coulon
Copy link
Author

Adding packages=[] to my setup.py does solve my problem.

Thanks @abravalheri

I must say that it is sad that we are forced to this new version of setuptools without any way to pin it to an old version.

@abravalheri
Copy link
Contributor

Hi all, I did some initial investigation on the failing tests and described my preliminary conclusions here.


Hi @jeremy-coulon, sorry to hear that.

I don't know exactly how is your setup, but the existing mechanism for projects pinning setuptools as a build-dependency is via pyproject.toml [build-system] requires, for example:

[build-system]
requires = ["setuptools<61"]
build-backend = "setuptools.build_meta"

@jeremy-coulon
Copy link
Author

I didn't have any pyproject.toml.

Adding this file also solves my problem.

Thanks.

@AndydeCleyre
Copy link
Contributor

@abravalheri

Thank you! Your help and explanation is very much appreciated.


If there are no objections, I'll close this one soon.

@lsiden
Copy link

lsiden commented Apr 4, 2022

I encountered the same error message and stack-trace as @jeremy-coulon . In setup.py I had a non-PyPI dependency:

'my_lib @ file:./my_lib.whl',

setuptools will not accept that.

'my_lib @ file:///path/to/my_lib.whl',

does work.

This is unfortunate, because
a) I don't have permission from my employer to upload my_lib.whl to PyPI.
b) I need to build my packages in a docker container. The path is particular to one docker image.

This makes my setup.py brittle.

@AndydeCleyre
Copy link
Contributor

@lsiden

Support for relpaths throughout the Python package ecosystem is ... picky.

Based on my work in #1329, I would suggest you format that as file:../my_lib.whl rather than the name @ URI form. Can you try that?

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

No branches or pull requests

7 participants