<p dir="auto">I'm building scipy from the latest source for the first time, running on Ubuntu in WSL2 on Windows 11. I tried following <a href="https://scipy.github.io/devdocs/dev/contributor/conda_guide.html#conda-guide" rel="nofollow">the conda guide</a>, but am getting errors when building. Searching around for the error it seems like it might be a unix/dos file ending mismatch, but I'm not sure how to fix it.</p>
<p dir="auto">Terminal output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="(scipy-dev) scott@DESKTOP-M5S4AGS:/mnt/c/Users/Scott/Documents/Documents/Coding/scipy$ python dev.py build
💻  ninja -C /mnt/c/Users/Scott/Documents/Documents/Coding/scipy/build
ninja: Entering directory `/mnt/c/Users/Scott/Documents/Documents/Coding/scipy/build'
[1/1533] Generating 'scipy/_lib/_ccallback_c.cpython-310-x86_64-linux-gnu.so.p/_ccallback_c.c'.
FAILED: scipy/_lib/_ccallback_c.cpython-310-x86_64-linux-gnu.so.p/_ccallback_c.c 
/mnt/c/Users/Scott/Documents/Documents/Coding/scipy/scipy/_build_utils/cythoner.py ../scipy/_lib/_ccallback_c.pyx scipy/_lib/_ccallback_c.cpython-310-x86_64-linux-gnu.so.p/_ccallback_c.c
/usr/bin/env: ‘python3\r’: No such file or directory
[2/1533] Generating 'scipy/_lib/_test_deprecation_call.cpython-310-x86_64-linux-gnu.so.p/_test_deprecation_call.c'.
FAILED: scipy/_lib/_test_deprecation_call.cpython-310-x86_64-linux-gnu.so.p/_test_deprecation_call.c 
/mnt/c/Users/Scott/Documents/Documents/Coding/scipy/scipy/_build_utils/cythoner.py ../scipy/_lib/_test_deprecation_call.pyx scipy/_lib/_test_deprecation_call.cpython-310-x86_64-linux-gnu.so.p/_test_deprecation_call.c
/usr/bin/env: ‘python3\r’: No such file or directory
[3/1533] Generating 'scipy/_lib/_test_deprecation_def.cpython-310-x86_64-linux-gnu.so.p/_test_deprecation_def.c'.
FAILED: scipy/_lib/_test_deprecation_def.cpython-310-x86_64-linux-gnu.so.p/_test_deprecation_def.c 
/mnt/c/Users/Scott/Documents/Documents/Coding/scipy/scipy/_build_utils/cythoner.py ../scipy/_lib/_test_deprecation_def.pyx scipy/_lib/_test_deprecation_def.cpython-310-x86_64-linux-gnu.so.p/_test_deprecation_def.c
/usr/bin/env: ‘python3\r’: No such file or directory
[4/1533] Generating 'scipy/_lib/messagestream.cpython-310-x86_64-linux-gnu.so.p/messagestream.c'.
FAILED: scipy/_lib/messagestream.cpython-310-x86_64-linux-gnu.so.p/messagestream.c 
/mnt/c/Users/Scott/Documents/Documents/Coding/scipy/scipy/_build_utils/cythoner.py ../scipy/_lib/messagestream.pyx scipy/_lib/messagestream.cpython-310-x86_64-linux-gnu.so.p/messagestream.c
/usr/bin/env: ‘python3\r’: No such file or directory
[6/1533] Generating scipy/generate-version with a custom command
fatal: bad revision '^v1.8.0'
[10/1533] Compiling C object scipy/special/libcephes.a.p/cephes_gamma.c.o
ninja: build stopped: subcommand failed.
Build failed!"><pre class="notranslate"><code class="notranslate">(scipy-dev) scott@DESKTOP-M5S4AGS:/mnt/c/Users/Scott/Documents/Documents/Coding/scipy$ python dev.py build
💻  ninja -C /mnt/c/Users/Scott/Documents/Documents/Coding/scipy/build
ninja: Entering directory `/mnt/c/Users/Scott/Documents/Documents/Coding/scipy/build'
[1/1533] Generating 'scipy/_lib/_ccallback_c.cpython-310-x86_64-linux-gnu.so.p/_ccallback_c.c'.
FAILED: scipy/_lib/_ccallback_c.cpython-310-x86_64-linux-gnu.so.p/_ccallback_c.c 
/mnt/c/Users/Scott/Documents/Documents/Coding/scipy/scipy/_build_utils/cythoner.py ../scipy/_lib/_ccallback_c.pyx scipy/_lib/_ccallback_c.cpython-310-x86_64-linux-gnu.so.p/_ccallback_c.c
/usr/bin/env: ‘python3\r’: No such file or directory
[2/1533] Generating 'scipy/_lib/_test_deprecation_call.cpython-310-x86_64-linux-gnu.so.p/_test_deprecation_call.c'.
FAILED: scipy/_lib/_test_deprecation_call.cpython-310-x86_64-linux-gnu.so.p/_test_deprecation_call.c 
/mnt/c/Users/Scott/Documents/Documents/Coding/scipy/scipy/_build_utils/cythoner.py ../scipy/_lib/_test_deprecation_call.pyx scipy/_lib/_test_deprecation_call.cpython-310-x86_64-linux-gnu.so.p/_test_deprecation_call.c
/usr/bin/env: ‘python3\r’: No such file or directory
[3/1533] Generating 'scipy/_lib/_test_deprecation_def.cpython-310-x86_64-linux-gnu.so.p/_test_deprecation_def.c'.
FAILED: scipy/_lib/_test_deprecation_def.cpython-310-x86_64-linux-gnu.so.p/_test_deprecation_def.c 
/mnt/c/Users/Scott/Documents/Documents/Coding/scipy/scipy/_build_utils/cythoner.py ../scipy/_lib/_test_deprecation_def.pyx scipy/_lib/_test_deprecation_def.cpython-310-x86_64-linux-gnu.so.p/_test_deprecation_def.c
/usr/bin/env: ‘python3\r’: No such file or directory
[4/1533] Generating 'scipy/_lib/messagestream.cpython-310-x86_64-linux-gnu.so.p/messagestream.c'.
FAILED: scipy/_lib/messagestream.cpython-310-x86_64-linux-gnu.so.p/messagestream.c 
/mnt/c/Users/Scott/Documents/Documents/Coding/scipy/scipy/_build_utils/cythoner.py ../scipy/_lib/messagestream.pyx scipy/_lib/messagestream.cpython-310-x86_64-linux-gnu.so.p/messagestream.c
/usr/bin/env: ‘python3\r’: No such file or directory
[6/1533] Generating scipy/generate-version with a custom command
fatal: bad revision '^v1.8.0'
[10/1533] Compiling C object scipy/special/libcephes.a.p/cephes_gamma.c.o
ninja: build stopped: subcommand failed.
Build failed!
</code></pre></div>
<p dir="auto">I ran into a problem running <code class="notranslate">dev.py</code> that appears to be caused by the shebang line <code class="notranslate">#!python3</code>  in the file <code class="notranslate">scipy/_build_utils/cythoner.py</code>. If I change it to <code class="notranslate">#!/usr/bin/env python</code> then the build works fine.</p>
<p dir="auto">Most files in scipy with a shebang line use <code class="notranslate">#!/usr/bin/env python</code>. Only files in the <code class="notranslate">_build_utils</code> use <code class="notranslate">#!python3</code>.</p>
<p dir="auto">Error message when running <code class="notranslate">python dev.py build</code>:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Meson build setup OK
💻  ninja -C /mnt/c/Users/Jozsef/OSS/scipy-test/build
ninja: Entering directory `/mnt/c/Users/Jozsef/OSS/scipy-test/build'
[3/1562] Generating 'scipy/_lib/_ccallback_c.cpython-310-x86_64-linux-gnu.so.p/_ccallback_c.c'.
FAILED: scipy/_lib/_ccallback_c.cpython-310-x86_64-linux-gnu.so.p/_ccallback_c.c
/mnt/c/Users/Jozsef/OSS/scipy-test/scipy/_build_utils/cythoner.py ../scipy/_lib/_ccallback_c.pyx scipy/_lib/_ccallback_c.cpython-310-x86_64-linux-gnu.so.p/_ccallback_c.c
/bin/sh: 1: /mnt/c/Users/Jozsef/OSS/scipy-test/scipy/_build_utils/cythoner.py: not found
[12/1562] Compiling C++ object scipy/_lib/_uarray/_uarray.cpython-310-x86_64-linux-gnu.so.p/_uarray_dispatch.cxx.o
ninja: build stopped: subcommand failed.
Build failed!"><pre class="notranslate">Meson build setup OK
💻  ninja -C /mnt/c/Users/Jozsef/OSS/scipy-test/build
ninja: Entering directory <span class="pl-s"><span class="pl-pds">`</span>/mnt/c/Users/Jozsef/OSS/scipy-test/build<span class="pl-s"><span class="pl-pds">'</span></span></span>
<span class="pl-s"><span class="pl-s">[3/1562] Generating <span class="pl-pds">'</span></span>scipy/_lib/_ccallback_c.cpython-310-x86_64-linux-gnu.so.p/_ccallback_c.c<span class="pl-s"><span class="pl-pds">'</span>.</span></span>
<span class="pl-s"><span class="pl-s">FAILED: scipy/_lib/_ccallback_c.cpython-310-x86_64-linux-gnu.so.p/_ccallback_c.c</span></span>
<span class="pl-s"><span class="pl-s">/mnt/c/Users/Jozsef/OSS/scipy-test/scipy/_build_utils/cythoner.py ../scipy/_lib/_ccallback_c.pyx scipy/_lib/_ccallback_c.cpython-310-x86_64-linux-gnu.so.p/_ccallback_c.c</span></span>
<span class="pl-s"><span class="pl-s">/bin/sh: 1: /mnt/c/Users/Jozsef/OSS/scipy-test/scipy/_build_utils/cythoner.py: not found</span></span>
<span class="pl-s"><span class="pl-s">[12/1562] Compiling C++ object scipy/_lib/_uarray/_uarray.cpython-310-x86_64-linux-gnu.so.p/_uarray_dispatch.cxx.o</span></span>
<span class="pl-s"><span class="pl-s">ninja: build stopped: subcommand failed.</span></span>
<span class="pl-s"><span class="pl-s">Build failed!</span></span></pre></div>
<p dir="auto">If I try running <code class="notranslate">cythoner.py</code> directly:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="-bash: /mnt/c/Users/Jozsef/OSS/scipy-conda/scipy/_build_utils/cythoner.py: python3: bad interpreter: No such file or directory"><pre class="notranslate">-bash: /mnt/c/Users/Jozsef/OSS/scipy-conda/scipy/_build_utils/cythoner.py: python3: bad interpreter: No such file or directory</pre></div>
<p dir="auto">I'm using conda with WSL (Ubuntu).</p>