uv: ModuleNotFoundError: No module named 'setuptools.command.test'

Overview

I got the similar error ModuleNotFoundError: No module named 'setuptools.command.test' with the install command on GitHub Actions as the benchmarks workflow was failed.

error: Failed to prepare distributions
  Caused by: Failed to fetch wheel: logbook==1.5.3
  Caused by: Failed to build: `logbook==1.5.3`
  Caused by: Build backend failed to determine extra requires with `build_wheel()` with exit status: 1
--- stdout:
--- stderr:
Traceback (most recent call last):
  File "<string>", line 14, in <module>
  File "/home/runner/.cache/uv/builds-v0/.tmp6kYDCi/lib/python3.11/site-packages/setuptools/build_meta.py", line 327, in get_requires_for_build_wheel
    return self._get_build_requires(config_settings, requirements=[])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/.cache/uv/builds-v0/.tmp6kYDCi/lib/python3.11/site-packages/setuptools/build_meta.py", line 297, in _get_build_requires
    self.run_setup()
  File "/home/runner/.cache/uv/builds-v0/.tmp6kYDCi/lib/python3.11/site-packages/setuptools/build_meta.py", line 497, in run_setup
    super().run_setup(setup_script=setup_script)
  File "/home/runner/.cache/uv/builds-v0/.tmp6kYDCi/lib/python3.11/site-packages/setuptools/build_meta.py", line 313, in run_setup
    exec(code, locals())
  File "<string>", line 64, in <module>
ModuleNotFoundError: No module named 'setuptools.command.test'

The failed benchmarks workflow

https://github.com/astral-sh/uv/actions/runs/10137169832/job/28027028298

error: Failed to download and build `pyhive==0.7.0`
  Caused by: Failed to build: `pyhive==0.7.0`
  Caused by: Build backend failed to determine extra requires with `build_wheel()` with exit status: 1
--- stdout:

--- stderr:
Traceback (most recent call last):
  File "<string>", line 14, in <module>
  File "/home/runner/work/uv/uv/.cache/builds-v0/.tmpuS9Fnv/lib/python3.10/site-packages/setuptools/build_meta.py", line 327, in get_requires_for_build_wheel
    return self._get_build_requires(config_settings, requirements=[])
  File "/home/runner/work/uv/uv/.cache/builds-v0/.tmpuS9Fnv/lib/python3.10/site-packages/setuptools/build_meta.py", line 297, in _get_build_requires
    self.run_setup()
  File "/home/runner/work/uv/uv/.cache/builds-v0/.tmpuS9Fnv/lib/python3.10/site-packages/setuptools/build_meta.py", line 497, in run_setup
    super().run_setup(setup_script=setup_script)
  File "/home/runner/work/uv/uv/.cache/builds-v0/.tmpuS9Fnv/lib/python3.10/site-packages/setuptools/build_meta.py", line 313, in run_setup
    exec(code, locals())
  File "<string>", line 4, in <module>
ModuleNotFoundError: No module named 'setuptools.command.test'

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 10
  • Comments: 28 (11 by maintainers)

Commits related to this issue

Most upvoted comments

For the future, you can also set UV_EXCLUDE_NEWER=2024-07-27 or similar to avoid pulling in new versions, at least temporarily.

It is extremely important to be able to constrain build environments. Whether it’s the same variable or not, but it’s important to be able to do it! It’s used all the time with PIP_CONSTRAINTS.

This isn’t uv’s fault. See https://github.com/pypa/setuptools/issues/4519#issuecomment-2254983472 , but use UV_CONSTRAINT env var instead

Edit: oops, UV_CONSTRAINT doesn’t actually work the same way, see https://github.com/astral-sh/uv/issues/5551#issuecomment-2255039974

Thanks. Still wondering if we should apply constraints to build environments 😃

As setuptools 72.0.0 has been yanked, I suppose we no longer need the workaround at the moment. I will close the issue in a few days for the visibility just in case, because some users might be still confused by the deprecation issue. Thank you all for your help.

https://pypi.org/project/setuptools/#history

Hi,

I’m not able to find a workaround for this as I’m using poetry. There is not option like “–no-build-isolation” in poetry. Can anyone help me please?

Thanks.

How about add the version constraint bot to use setuptools 72.0.0 until the issue is resolved? It might be hassle for each uv user to apply the workaround to its environment.

I’d still be interested if any uv folks have ideas for how to improve reproducibility of isolated build envs.

We should lock build environments, see https://github.com/astral-sh/uv/issues/5190

Using the --no-build-isolation flag works for me (uv correctly uses the installed version of setuptools)