Repository navigation
Installing 8.5.0 with --no-binary=:all: results in LookupError #516
Description
Activity
It's related
I solved the loop for setuptools scm itself
But now the build env of importlib metadata requires importlib metadata
@jaraco is there a reasonable way to provide altered pyproject.toml inside a sdist
Reacted by Daniela Plascenciaalso i strongly recommend never to use source only installs unless you have full control of the build process
and arguably anyone hitting this issue outside of distro packaging is in fact not in control of the build process
This problem is another manifestation of pypa/packaging-problems#342. Essentially, it's not possible for build backends (or their plugins) to have dependencies that use said build backend.
I've proposed several solutions, but none of which are without tradeoffs, and many of which push the bootstrapping problem onto those environments that wish to build everything from source.
I have one approach that I'm currently exploring in the
coherent.buildsystem that addresses the problem by producing sdists that build on a more primitive build backend (like flit). If I were to migrate importlib_metadata to coherent.build (with the experimental feature enabled) (or move to flit), the problem would go away, but for importlib_metadata only. I'd still have to apply the same treatment for every dependency of setuptools_scm (and Setuptools itself once I can get it to unvendor its dependencies).Unfortunately, support for Python 3.8 is dropped, so there's little hope of these innovations addressing the issue on Python 3.8.
There are many hacks that system integrators have used to work around the cyclic dependency issues, namely:
- avoiding use of setuptools_scm by hand-coding the version with SETUPTOOLS_SCM_PRETEND_VERSION (or similar)
- converting projects to flit before building
Another workaround that's been proposed - while bootstrapping the build backends (Setuptools+setuptools-scm in this case), ensure all of the (transitive) dependencies are present in the PYTHONPATH, either by pre-loading them from pre-built trusted installs or by manually assembling the Python modules from sources into an importable form, and then building the backend without build isolation.
It's a difficult problem to comprehend and an even more difficult problem to solve, which is why it's still broken. Good luck!
@abravalheri @jaraco can we expand setuptools sdist building in a way that allows somthing like setuptools_scm to reasonably replace build dependencies and dynamic fields
the idea would be to move the setuptools_scm dependency into something setuptools can omit for a sdist
same goes for file finer output
that way new sdists could ship whats needed in a more safe manner
Reacted by Daniela PlascenciaI think the short answer is no, mainly because Setuptools (and by extension every backend that has dependencies that lead to itself) would need to re-write the user's sources to produce the sdist. That is, if the user has declared
build-requires=['setuptools-scm'], they've declared that for the build. PEP 518 and 517 doesn't provide enough granularity for the user to indicatebuild-wheel-requires=['setuptools-scm']butbuild-sdist-requires[]. Therefore, to prevent an installer from rightfully attempting to install a cyclic dependency, thebuild-requireswould have to be different for sources than for source distributions. Moreover, that's just a half-step toward what coherent.build is doing in compiling the sources to a different backend for sdists. It's true that Setuptools doesn't rely on setuptools-scm except at the build from source stage (it's no longer needed at the build from sdist stage), but that guarantee doesn't hold in general; it's a special case for setuptools-scm. If Setuptools is going to special-case something for setuptools-scm, it should be to integrate it. Otherwise, whatever solution is devised should apply to any dependency. The landscape is already complicated enough without carving out special cases for specific dependencies.As build backends can report additional dependencies the idea is more around being able to skip some if the metadata is provided by the sdist instead of rewriting the code
As build backends can report additional dependencies the idea is more around being able to skip some if the metadata is provided by the sdist instead of rewriting the code
Reading between the lines, I think you're suggesting:
- Setuptools-scm users are directed to stop specifying setuptools-scm in
build-requiresin pyproject.toml. - Setuptools adds a feature flag to enable setuptools-scm.
- When a user specifies to enable setuptools-scm, setuptools will include 'setuptools-scm' in the response to
get_build_requires_for_sdistbut notget_build_requires_for_wheel.
That sounds like a lot of work and a very special case. Currently, setuptools relies on the presence or absence of the plugin to determine whether the feature is enabled or not. If setuptools-scm were to require a different paradigm for inclusion/enablement, it also has implications for the designs of other plugins.
In any case, this issue is not a great place to be having this discussion, since the issue relates to setuptools and setuptools-scm and the Python packaging ecosystem as a whole and has nothing to do with importlib_metadata other than that importlib_metadata happens to be caught in the problem because it happens to be a dependency of a build backend's plugin.
The only reason I'm not closing this issue is because I'm reserving it to track replacing the build system to side step the problem.
- Setuptools-scm users are directed to stop specifying setuptools-scm in
No id prefer to enable setuptools to provide dynamic requires depending on whether its running on a sdist or on a vcs checkout
But if that fails I'll work towards creating a separate build backend library in the dependency loop of build backends that can self build from its sdist and enable any sdist with matching tooling to do the same without loops
Additionally most users will not need any changes
But any build backend or dependeny of core build backends will change
No id prefer to enable setuptools to provide dynamic requires depending on whether its running on a sdist or on a vcs checkout
But if that fails I'll work towards creating a separate build backend library in the dependency loop of build backends that can self build from its sdist and enable any sdist with matching tooling to do the same without loops
Please bring these ideas to packaging-problems or setuptools; I don't want to continue having packaging ecosystem problems in this issue, as this project is the wrong audience. This issue is about fixing the issue importlib_metadata specifically.
- added a commit that references this issue
on Apr 29, 2025 5 remaining items
- added 4 commits that reference this issue
on May 6, 2025 - added 6 commits that reference this issue
on May 6, 2025 - added a commit that references this issue
on May 6, 2025 - added a commit that references this issue
on May 7, 2025 - added a commit that references this issue
on Jun 27, 2025 We're presently facing this particular issue with
python-3.9.23andimportlib_metadata-8.7.0:LookupError: https://files.pythonhosted.org/packages/76/66/650a33bd90f786193e4de4b3ad86ea60b53c89b669a5c7be931fac31cdb0/importlib_metadata-8.7.0.tar.gz (from https://pypi.org/simple/importlib-metadata/) (requires-python:>=3.9) is already being built: importlib-metadata>=4.6 from https://files.pythonhosted.org/packages/76/66/650a33bd90f786193e4de4b3ad86ea60b53c89b669a5c7be931fac31cdb0/importlib_metadata-8.7.0.tar.gz (from setuptools_scm)white trying to (cross-)compile software stack that includes Python and a few python modules.
pypa/setuptools-scm#1152 should resolve that with the next setuptools_scm release
Reacted by Allen Hancock and Daniela PlascenciaReacted by Daniela Plascencia
This is a very similar issue to #392, but for me it is happening on py3.8.
Steps to reproduce
(on py3.8)
pip install --no-binary=:all: importlib-metadataRelevant output log
Additional context
pypa/setuptools-scm#1131 was recently reported and closed, and may be related.