setuptools-rust: failure to build binary in MSYS2 (MinGW) environment

G’day,

this is related to PyO3/maturin/issues/2370 (pip install maturin fails under MSYS2).

Executing the test session mypy within an MSYSY2 environment results in a failure of the maturin executable not being found.

$> cat /proc/version
MSYS_NT-10.0-26100 version 3.5.7-2644508f.x86_64 (runneradmin@fv-az1853-986) (gcc version 13.3.0 (GCC) ) 2025-01-30 09:08 UTC
$> .venv/bin/pip --version
pip 24.2 from /c/Users/me/Repositories/github.com/PyO3/setuptools-rust/.venv/lib/python3.12/site-packages/pip (python 3.12)
$> .venv/bin/python3 --version
Python 3.12.7
$> rustc --version
rustc 1.83.0 (90b35a623 2024-11-26) (Rev2, Built by MSYS2 project)
$> cargo --version
cargo 1.83.0 (5ffbef321 2024-10-29)
$> .venv/bin/nox -s mypy --verbose 2>&1 | tee nox-s-mypy.txt
...
                Finished `release` profile [optimized] target(s) in 1m 39s
            error: Rust build failed; unable to locate executable 'maturin'
            [end of output]

        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for maturin
      Failed to build maturin
      ERROR: Failed to build installable wheels for some pyproject.toml based projects (maturin)
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
nox > Session mypy failed.

nox-s-mypy.txt

Other tests fail as well, but I picked the one that executed fastest in my environment, since I am doing a root cause analysis at the moment and think they are all related to the same cause.

@messense already suggested a fix (PyO3/setuptools-rust/pull/521) which (sadly) did not work.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Great, it sounds like this is solved for everyone?

Ah, that’s unfortunate. Thanks for digging into this further, please ask any Q’s and I’ll try to be of timely use. I changed the title 👍

If #521 fixes the issue, it’s possible that retrying now that I’ve pushed setuptools-rust v1.11.1 just now.

Thanks! I’ll try again, but the fix didn’t resolve the issue when I tried it a couple of days ago.