<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>16235</bug_id>
          
          <creation_ts>2026-04-08 10:03:46 +0000</creation_ts>
          <short_desc>Python recipes occasionally fail with &quot;invalid command &apos;egg_info&apos;&quot;</short_desc>
          <delta_ts>2026-04-21 17:01:13 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>core</component>
          <version>6.0</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>6.1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Peter Kjellerstedt">peter.kjellerstedt</reporter>
          <assigned_to name="Ross Burton">ross.burton</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>pavel</cc>
    
    <cc>peter.kjellerstedt</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>tim.orling</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>104983</commentid>
    <comment_count>0</comment_count>
    <who name="Peter Kjellerstedt">peter.kjellerstedt</who>
    <bug_when>2026-04-08 10:03:46 +0000</bug_when>
    <thetext>Occasionally most (all?) python recipes fail to compile with:

  error: invalid command &apos;egg_info&apos;

Running `bitbake -c clean` for the affected recipes get them back to working.

I have not figured out what triggers the problem or a way to reproduce it. It typically happens after updating the openembedded-core layer so my guess is that it is related to some tasks being fetched from the sstate cache, and some tasks having to rebuild.

Here is a full error log for `python3-calver-native`:

DEBUG: Executing shell function do_compile
+ cd .../qemux86-64-alt/tmp/work/x86_64-linux/python3-calver-native/2025.10.20/sources/python3-calver-2025.10.20
+ do_compile
+ python_pep517_do_compile
+ pyproject-build --no-isolation --wheel --outdir .../qemux86-64-alt/tmp/work/x86_64-linux/python3-calver-native/2025.10.20/dist .../qemux86-64-alt/tmp/work/x86_64-linux/python3-calver-native/2025.10.20/sources/python3-calver-2025.10.20
* Getting build dependencies for wheel...
usage: _in_process.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: _in_process.py --help [cmd1 cmd2 ...]
   or: _in_process.py --help-commands
   or: _in_process.py cmd --help

error: invalid command &apos;egg_info&apos;

ERROR Backend subprocess exited when trying to invoke get_requires_for_build_wheel</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105015</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2026-04-09 14:44:11 +0000</bug_when>
    <thetext>Also reported by people on IRC.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105017</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2026-04-09 14:46:30 +0000</bug_when>
    <thetext>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&apos;s an upstream bug somewhere, and I can dig out the fix we&apos;d previously applied.  For now, cleaning is acceptable...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105044</commentid>
    <comment_count>3</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2026-04-10 21:36:29 +0000</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105045</commentid>
    <comment_count>4</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2026-04-10 21:37:40 +0000</bug_when>
    <thetext>s/Ross/Ross and Peter/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105049</commentid>
    <comment_count>5</comment_count>
    <who name="Pavel Zhukov">pavel</who>
    <bug_when>2026-04-12 17:09:08 +0000</bug_when>
    <thetext>(In reply to Tim Orling from comment #3)
&gt; This seems to happen for recipes that inherit `setuptools3` or
&gt; `python_setuptools_build_meta` when there is stale sstate cache. Or at least
&gt; `bitbake -c cleansstate python3-pytest` worked for me (several other recipes
&gt; needed the same). Ross maybe correct that only `bitbake -c clean` is needed.
&gt; I did not test that.

I think it&apos;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105050</commentid>
    <comment_count>6</comment_count>
    <who name="Peter Kjellerstedt">peter.kjellerstedt</who>
    <bug_when>2026-04-12 17:35:46 +0000</bug_when>
    <thetext>After Ross&apos; 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 &quot;meson.bblcass: Remove empty egg-info directories before running meson&quot;, where I apparently solved this problem for Meson based projects. However, it appears a more generic solution is needed...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105051</commentid>
    <comment_count>7</comment_count>
    <who name="Peter Kjellerstedt">peter.kjellerstedt</who>
    <bug_when>2026-04-12 17:40:04 +0000</bug_when>
    <thetext>There is also commit 73de8daa6293403f5b92d313af32882c47bce396 &quot;python3: backport the full fix for importlib scanning invalid distributions&quot; by Ross, where a local patch that seems to have ignored empty directories supposedly have been replaced by some upstream fix.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105052</commentid>
    <comment_count>8</comment_count>
    <who name="Peter Kjellerstedt">peter.kjellerstedt</who>
    <bug_when>2026-04-12 17:51:55 +0000</bug_when>
    <thetext>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 &quot;python3: Ensure stale empty python module directories don&apos;t break the build&quot;. 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...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105082</commentid>
    <comment_count>9</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2026-04-15 16:27:38 +0000</bug_when>
    <thetext>My memory is that the upstream fix we proposed was quite deep in the importlib code and they wanted to return &quot;empty&quot; modules to the caller, so we should go and fix the callers.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105144</commentid>
    <comment_count>10</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2026-04-17 15:58:06 +0000</bug_when>
    <thetext>Root-caused and filed a ticket and two potential fixes upstream: https://github.com/python/importlib_metadata/issues/534</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105146</commentid>
    <comment_count>11</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2026-04-17 16:07:06 +0000</bug_when>
    <thetext>PATCH ON THE LIST.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105175</commentid>
    <comment_count>12</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2026-04-21 17:01:13 +0000</bug_when>
    <thetext>Fixed in oe-core 855d1111c3da40edc05ec300839f7003a388e3c4.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>