| Summary: | Python recipes occasionally fail with "invalid command 'egg_info'" | ||
|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] OE-Core | Reporter: | Peter Kjellerstedt <peter.kjellerstedt> |
| Component: | core | Assignee: | Ross Burton <ross.burton> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | Medium | CC: | meta.mr.watcher, meta.watcher, pavel, peter.kjellerstedt, randy.macleod, tim.orling |
| Version: | 6.0 | ||
| Target Milestone: | 6.1 | ||
| Hardware: | x86 | ||
| OS: | Multiple | ||
| Whiteboard: | |||
| OS type for building Yocto: | --- | Type of Regression: | --- |
| Verified: | Documentation change: | No (bug/feature does not impact docs) | |
|
Description
Peter Kjellerstedt
2026-04-08 10:03:46 UTC
Also reported by people on IRC. The hunch is that this is due to an upgrade happening to dependencies which leaves an empty directory in site-packages, which importlib then reports as a module although it has no metadata. There's an upstream bug somewhere, and I can dig out the fix we'd previously applied. For now, cleaning is acceptable... This seems to happen for recipes that inherit `setuptools3` or `python_setuptools_build_meta` when there is stale sstate cache. Or at least `bitbake -c cleansstate python3-pytest` worked for me (several other recipes needed the same). Ross maybe correct that only `bitbake -c clean` is needed. I did not test that. s/Ross/Ross and Peter/ (In reply to Tim Orling from comment #3) > This seems to happen for recipes that inherit `setuptools3` or > `python_setuptools_build_meta` when there is stale sstate cache. Or at least > `bitbake -c cleansstate python3-pytest` worked for me (several other recipes > needed the same). Ross maybe correct that only `bitbake -c clean` is needed. > I did not test that. I think it's not because of sstate but workdir. It happened to me only with stale workdir/tmpdir. Simple clean (not cleatsstate) and/or buiding on the builder with shared sstate but with completely new tmpdir solves the problem. After Ross' comment, I had a feeling of déjà vu. And it turned out to be right. I have apparently been bothered by this before, and after some searching in the logs, I found commit 47d9d90b4ec7d04d6f3f1a9b97c0ab7f1264a88e "meson.bblcass: Remove empty egg-info directories before running meson", where I apparently solved this problem for Meson based projects. However, it appears a more generic solution is needed... There is also commit 73de8daa6293403f5b92d313af32882c47bce396 "python3: backport the full fix for importlib scanning invalid distributions" by Ross, where a local patch that seems to have ignored empty directories supposedly have been replaced by some upstream fix. And of course, further investigation of the logs show that my commit (47d9d90b4ec) was reverted in commit ebdb49b9292bf8e61ef0a3f56ff76fcab3ac503f because RP had in fact added a more generic solution in commit e5944a38db513e033c3a3e9313267055f7254be7 "python3: Ensure stale empty python module directories don't break the build". This was the one that Ross later reverted in commit 73de8daa62. So either that backported patch (meta/recipes-devtools/python/python3/valid-dists.patch, which we apparently still have) did not actually solve the problem of empty directories, or upstream has broken them yet again... My memory is that the upstream fix we proposed was quite deep in the importlib code and they wanted to return "empty" modules to the caller, so we should go and fix the callers. Root-caused and filed a ticket and two potential fixes upstream: https://github.com/python/importlib_metadata/issues/534 PATCH ON THE LIST. Fixed in oe-core 855d1111c3da40edc05ec300839f7003a388e3c4. |