<p dir="auto">By example, the issue is that NumPy scalars are formatted to strings differently:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import numpy as np

x = np.float32(101.1)
print(f&quot;unexpected: {x}&quot;)        # unexpected: 101.0999984741211
print(f&quot;expected str: {x!s}&quot;)    # expected str: 101.1
print(f&quot;expected repr: {x!r}&quot;)   # expected repr: 101.1
print(f&quot;expected ascii: {x!a}&quot;)  # expected ascii: 101.1"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>

<span class="pl-s1">x</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">float32</span>(<span class="pl-c1">101.1</span>)
<span class="pl-en">print</span>(<span class="pl-s">f"unexpected: <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">x</span><span class="pl-kos">}</span></span>"</span>)        <span class="pl-c"># unexpected: 101.0999984741211</span>
<span class="pl-en">print</span>(<span class="pl-s">f"expected str: <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">x</span>!s<span class="pl-kos">}</span></span>"</span>)    <span class="pl-c"># expected str: 101.1</span>
<span class="pl-en">print</span>(<span class="pl-s">f"expected repr: <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">x</span>!r<span class="pl-kos">}</span></span>"</span>)   <span class="pl-c"># expected repr: 101.1</span>
<span class="pl-en">print</span>(<span class="pl-s">f"expected ascii: <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">x</span>!a<span class="pl-kos">}</span></span>"</span>)  <span class="pl-c"># expected ascii: 101.1</span></pre></div>
<p dir="auto">The unexpected outcome is because the 32-bit float value is converted to native Python double precision, and then formatted as a string type. The last three examples with expected outputs use a <a href="https://docs.python.org/3/library/string.html#format-string-syntax" rel="nofollow">format conversion field</a>, which call (e.g.) <code class="notranslate">__repr__</code>.</p>
<p dir="auto">A suggested fix would be to implement a <a href="https://docs.python.org/3/reference/datamodel.html#object.__format__" rel="nofollow"><code class="notranslate">__format__</code> method</a> for (some?) numpy scalar types.</p>
<h3 dir="auto">Describe the issue:</h3>
<p dir="auto">This could be related:<br>
<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1180405378" data-permission-text="Title is private" data-url="https://github.com/pypa/setuptools/issues/3197" data-hovercard-type="issue" data-hovercard-url="/pypa/setuptools/issues/3197/hovercard?comment_id=1086858941&amp;comment_type=issue_comment" href="https://github.com/pypa/setuptools/issues/3197#issuecomment-1086858941">pypa/setuptools#3197 (comment)</a></p>
<p dir="auto">Latest numpy release (1.22.3) cannot build from source when using latest setuptools.</p>
<h3 dir="auto">Reproduce the code example:</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="python3 -m pip install -Uv setuptools==61.3.1
python3 -m pip install -Uv git+https://github.com/numpy/numpy.git@v1.22.3"><pre class="notranslate"><span class="pl-s1">python3</span> <span class="pl-c1">-</span><span class="pl-s1">m</span> <span class="pl-s1">pip</span> <span class="pl-s1">install</span> <span class="pl-c1">-</span><span class="pl-v">Uv</span> <span class="pl-s1">setuptools</span><span class="pl-c1">==</span><span class="pl-c1">61.3</span>.<span class="pl-c1">1</span>
<span class="pl-s1">python3</span> <span class="pl-c1">-</span><span class="pl-s1">m</span> <span class="pl-s1">pip</span> <span class="pl-s1">install</span> <span class="pl-c1">-</span><span class="pl-v">Uv</span> <span class="pl-s1">git</span><span class="pl-c1">+</span><span class="pl-s1">https</span>:<span class="pl-c1">//</span><span class="pl-s1">github</span>.<span class="pl-s1">com</span><span class="pl-c1">/</span><span class="pl-s1">numpy</span><span class="pl-c1">/</span><span class="pl-s1">numpy</span>.<span class="pl-s1">git</span>@<span class="pl-s1">v1</span>.<span class="pl-c1">22.3</span></pre></div>
<h3 dir="auto">Error message:</h3>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#9 529.2 Using pip 22.0.4 from /usr/local/lib/python3.9/dist-packages/pip (python 3.9)                                                                                                                                                                        
#9 529.3 Looking in indexes: https://mirrors.aliyun.com/pypi/simple                                                                                                                                                                                           
#9 529.3 Processing ./mirrored-pip-GRCQUK/numpy                                                                                                                                                                                                               
#9 529.5   Installing build dependencies: started                                                                                                                                                                                                             
#9 529.5   Running command pip subprocess to install build dependencies                                                                                                                                                                                       
#9 531.1   Looking in indexes: https://mirrors.aliyun.com/pypi/simple                                                                                                                                                                                         
#9 531.1   Ignoring packaging: markers 'platform_machine == &quot;arm64&quot;' don't match your environment                                                                                                                                                             
#9 531.7   Collecting setuptools==59.2.0                                                                                                                                                                                                                      
#9 531.8     Downloading https://mirrors.aliyun.com/pypi/packages/18/ad/ec41343a49a0371ea40daf37b1ba2c11333cdd121cb378161635d14b9750/setuptools-59.2.0-py3-none-any.whl (952 kB)                                                                              
#9 533.1        ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 952.0/952.0 KB 734.9 kB/s eta 0:00:00                                                                                                                                                                   
#9 533.2   Collecting wheel==0.37.0                                                                                                                                                                                                                           
#9 533.2     Downloading https://mirrors.aliyun.com/pypi/packages/04/80/cad93b40262f5d09f6de82adbee452fd43cdff60830b56a74c5930f7e277/wheel-0.37.0-py2.py3-none-any.whl (35 kB)                                                                                
#9 534.0   Collecting Cython&lt;3.0,&gt;=0.29.24                                                                                                                                                                                                                    
#9 534.0     Downloading https://mirrors.aliyun.com/pypi/packages/9a/26/d2b6bc4cb7d716c82ebc89690cbd5ba0f547db364809cd42dad34d593182/Cython-0.29.28-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (1.9 MB)                   
#9 536.6        ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.9/1.9 MB 761.3 kB/s eta 0:00:00                                                                                                                                                                    
#9 536.9   Installing collected packages: wheel, setuptools, Cython                                                                                                                                                                                           
#9 537.8   Successfully installed Cython-0.29.28 setuptools-59.2.0 wheel-0.37.0                                                                                                                                                                               
#9 537.8   WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv                      
#9 537.9   Installing build dependencies: finished with status 'done'                                                                                                                                                                                         
#9 537.9   Getting requirements to build wheel: started                                                                                                                                                                                                       
#9 537.9   Running command Getting requirements to build wheel                                                                                                                                                                                                
#9 538.3   Running from numpy source directory.                                                                                                                                                                                                               
#9 539.2   error: Multiple top-level packages discovered in a flat-layout: ['numpy', 'branding'].                                                                                                                                                             
#9 539.2                                                                                                                                                                                                                                                      
#9 539.2   To avoid accidental inclusion of unwanted files or directories,                                                                                                                                                                                    
#9 539.2   setuptools will not proceed with this build.                                                                                                                                                                                                       
#9 539.2                                                                                                                                                                                                                                                      
#9 539.2   If you are trying to create a single distribution with multiple packages                                                                                                                                                                           
#9 539.2   on purpose, you should not rely on automatic discovery.                                                                                                                                                                                            
#9 539.2   Instead, consider the following options:                                                                                                                                                                                                           
#9 539.2                                                                                                                                                                                                                                                      
#9 539.2   1. set up custom discovery (`find` directive with `include` or `exclude`)                                                                                                                                                                          
#9 539.2   2. use a `src-layout`                                                                                                                                                                                                                              
#9 539.2   3. explicitly set `py_modules` or `packages` with a list of names                                                                                                                                                                                  
#9 539.2                                                                                                                                                                                                                                                      
#9 539.2   To find more information, look for &quot;package discovery&quot; on setuptools docs.                                                                                                                                                                         
#9 539.3   error: subprocess-exited-with-error                                                                                                                                                                                                                
#9 539.3                                                                                                                                                                                                                                                      
#9 539.3   × Getting requirements to build wheel did not run successfully.                                                                                                                                                                                    
#9 539.3   │ exit code: 1                                                                                                                                                                                                                                     
#9 539.3   ╰─&gt; See above for output.                                                                                                                                                                                                                          
#9 539.3                                                                                                                                                                                                                                                      
#9 539.3   note: This error originates from a subprocess, and is likely not a problem with pip.                                                                                                                                                               
#9 539.3   full command: /usr/bin/python3 /usr/local/lib/python3.9/dist-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpis1s8vl8                                                                                   
#9 539.3   cwd: /tmp/scratch/mirrored-pip-GRCQUK/numpy                                                                                                                                                                                                        
#9 539.3   Getting requirements to build wheel: finished with status 'error'                                                                                                                                                                                  
#9 539.3 error: subprocess-exited-with-error                                                                                                                                                                                                                  
#9 539.3                                                                                                                                                                                                                                                      
#9 539.3 × Getting requirements to build wheel did not run successfully.                                                                                                                                                                                      
#9 539.3 │ exit code: 1                                                                                                                                                                                                                                       
#9 539.3 ╰─&gt; See above for output.                                                                                                                                                                                                                            
#9 539.3                                                                                                                                                                                                                                                      
#9 539.3 note: This error originates from a subprocess, and is likely not a problem with pip."><pre class="notranslate"><span class="pl-c"><span class="pl-c">#</span>9 529.2 Using pip 22.0.4 from /usr/local/lib/python3.9/dist-packages/pip (python 3.9)                                                                                                                                                                        </span>
<span class="pl-c"><span class="pl-c">#</span>9 529.3 Looking in indexes: https://mirrors.aliyun.com/pypi/simple                                                                                                                                                                                           </span>
<span class="pl-c"><span class="pl-c">#</span>9 529.3 Processing ./mirrored-pip-GRCQUK/numpy                                                                                                                                                                                                               </span>
<span class="pl-c"><span class="pl-c">#</span>9 529.5   Installing build dependencies: started                                                                                                                                                                                                             </span>
<span class="pl-c"><span class="pl-c">#</span>9 529.5   Running command pip subprocess to install build dependencies                                                                                                                                                                                       </span>
<span class="pl-c"><span class="pl-c">#</span>9 531.1   Looking in indexes: https://mirrors.aliyun.com/pypi/simple                                                                                                                                                                                         </span>
<span class="pl-c"><span class="pl-c">#</span>9 531.1   Ignoring packaging: markers 'platform_machine == "arm64"' don't match your environment                                                                                                                                                             </span>
<span class="pl-c"><span class="pl-c">#</span>9 531.7   Collecting setuptools==59.2.0                                                                                                                                                                                                                      </span>
<span class="pl-c"><span class="pl-c">#</span>9 531.8     Downloading https://mirrors.aliyun.com/pypi/packages/18/ad/ec41343a49a0371ea40daf37b1ba2c11333cdd121cb378161635d14b9750/setuptools-59.2.0-py3-none-any.whl (952 kB)                                                                              </span>
<span class="pl-c"><span class="pl-c">#</span>9 533.1        ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 952.0/952.0 KB 734.9 kB/s eta 0:00:00                                                                                                                                                                   </span>
<span class="pl-c"><span class="pl-c">#</span>9 533.2   Collecting wheel==0.37.0                                                                                                                                                                                                                           </span>
<span class="pl-c"><span class="pl-c">#</span>9 533.2     Downloading https://mirrors.aliyun.com/pypi/packages/04/80/cad93b40262f5d09f6de82adbee452fd43cdff60830b56a74c5930f7e277/wheel-0.37.0-py2.py3-none-any.whl (35 kB)                                                                                </span>
<span class="pl-c"><span class="pl-c">#</span>9 534.0   Collecting Cython&lt;3.0,&gt;=0.29.24                                                                                                                                                                                                                    </span>
<span class="pl-c"><span class="pl-c">#</span>9 534.0     Downloading https://mirrors.aliyun.com/pypi/packages/9a/26/d2b6bc4cb7d716c82ebc89690cbd5ba0f547db364809cd42dad34d593182/Cython-0.29.28-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (1.9 MB)                   </span>
<span class="pl-c"><span class="pl-c">#</span>9 536.6        ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.9/1.9 MB 761.3 kB/s eta 0:00:00                                                                                                                                                                    </span>
<span class="pl-c"><span class="pl-c">#</span>9 536.9   Installing collected packages: wheel, setuptools, Cython                                                                                                                                                                                           </span>
<span class="pl-c"><span class="pl-c">#</span>9 537.8   Successfully installed Cython-0.29.28 setuptools-59.2.0 wheel-0.37.0                                                                                                                                                                               </span>
<span class="pl-c"><span class="pl-c">#</span>9 537.8   WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv                      </span>
<span class="pl-c"><span class="pl-c">#</span>9 537.9   Installing build dependencies: finished with status 'done'                                                                                                                                                                                         </span>
<span class="pl-c"><span class="pl-c">#</span>9 537.9   Getting requirements to build wheel: started                                                                                                                                                                                                       </span>
<span class="pl-c"><span class="pl-c">#</span>9 537.9   Running command Getting requirements to build wheel                                                                                                                                                                                                </span>
<span class="pl-c"><span class="pl-c">#</span>9 538.3   Running from numpy source directory.                                                                                                                                                                                                               </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.2   error: Multiple top-level packages discovered in a flat-layout: ['numpy', 'branding'].                                                                                                                                                             </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.2                                                                                                                                                                                                                                                      </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.2   To avoid accidental inclusion of unwanted files or directories,                                                                                                                                                                                    </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.2   setuptools will not proceed with this build.                                                                                                                                                                                                       </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.2                                                                                                                                                                                                                                                      </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.2   If you are trying to create a single distribution with multiple packages                                                                                                                                                                           </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.2   on purpose, you should not rely on automatic discovery.                                                                                                                                                                                            </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.2   Instead, consider the following options:                                                                                                                                                                                                           </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.2                                                                                                                                                                                                                                                      </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.2   1. set up custom discovery (`find` directive with `include` or `exclude`)                                                                                                                                                                          </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.2   2. use a `src-layout`                                                                                                                                                                                                                              </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.2   3. explicitly set `py_modules` or `packages` with a list of names                                                                                                                                                                                  </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.2                                                                                                                                                                                                                                                      </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.2   To find more information, look for "package discovery" on setuptools docs.                                                                                                                                                                         </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.3   error: subprocess-exited-with-error                                                                                                                                                                                                                </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.3                                                                                                                                                                                                                                                      </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.3   × Getting requirements to build wheel did not run successfully.                                                                                                                                                                                    </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.3   │ exit code: 1                                                                                                                                                                                                                                     </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.3   ╰─&gt; See above for output.                                                                                                                                                                                                                          </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.3                                                                                                                                                                                                                                                      </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.3   note: This error originates from a subprocess, and is likely not a problem with pip.                                                                                                                                                               </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.3   full command: /usr/bin/python3 /usr/local/lib/python3.9/dist-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpis1s8vl8                                                                                   </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.3   cwd: /tmp/scratch/mirrored-pip-GRCQUK/numpy                                                                                                                                                                                                        </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.3   Getting requirements to build wheel: finished with status 'error'                                                                                                                                                                                  </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.3 error: subprocess-exited-with-error                                                                                                                                                                                                                  </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.3                                                                                                                                                                                                                                                      </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.3 × Getting requirements to build wheel did not run successfully.                                                                                                                                                                                      </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.3 │ exit code: 1                                                                                                                                                                                                                                       </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.3 ╰─&gt; See above for output.                                                                                                                                                                                                                            </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.3                                                                                                                                                                                                                                                      </span>
<span class="pl-c"><span class="pl-c">#</span>9 539.3 note: This error originates from a subprocess, and is likely not a problem with pip.</span></pre></div>
<h3 dir="auto">NumPy/Python version information:</h3>
<p dir="auto">Numpy 1.22.3<br>
Python 3.9<br>
Debian 11<br>
Setuptools 61.3.1</p>