-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
BUG: Build from source can fail on Windows for scikit-learn v1.6.1 with Ninja mkdir
error
#31123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for the detailed issue 🙏! Unfortunately this will likely be a tricky one. I don't think any of the maintainers has access to a Windows ARM64 machine and even if we did, we are not super familiar with Windows compilation. If there is a way to change our meson files without complicating it too much and to make it work for your use case, we would be willing to accept such a PR. In particular maybe there is a way to avoid such a nested folder structure For the long path hypothesis, I am a bit surprised since MAXPATH is 260 characters according to this Windows doc and in the error message the path is 149 characters long but maybe this is the absolute path that counts 🤔:
I did find a ninja issue ninja-build/ninja#2442 and an ongoing PR ninja-build/ninja#2552 that you could maybe test to see if that fixes the issue. |
Actually looking a bit more, this is not ARM64 specific and I can reproduce on a amd64 Windows VM doing: # This use --no-binary scikit-learn to make sure to compile from sdist rather than use the wheel
pip install scikit-learn --no-binary scikit-learn -v @Molier as a work-around could you try if this command works for you (it does for me):
This passes an explicit build directory to meson-python following the doc and should avoid too long paths. By default, the build dir is auto-generated even when setting There may be ways to reduce a bit the lengths of meson auto-generated files (maybe by 40 characters or so) in our |
mkdir
errormkdir
error
I opened #31212 that reduces the generated files maximum path length by ~50 characters and make it less likely that the Windows path limitation is hit. |
#31212 has been merged which should reduce the likelihood of this happening, let's close this one. |
Labels:
Bug
,Build / CI
,Needs Triage
(Suggested)Describe the bug
Scikit-learn (v1.6.1) fails to build from source on a native Windows 11 ARM64 machine using the MSYS2 ClangARM64 toolchain. The build proceeds through the Meson setup phase correctly identifying the
clang
compiler, but fails during theninja
compilation phase with an error indicating it cannot create a specific, deeply nested intermediate build directory.This occurs despite successfully building other complex dependencies like NumPy (v2.2.4) and SciPy (v1.15.2) from source in the exact same environment. Pandas (v2.2.3) also builds successfully after setting
MESON_DISABLE_VSENV=1
(otherwise it incorrectly selects MSVC). This suggests the issue might be specific to how scikit-learn's build structure interacts with Meson/Ninja within this particular toolchain environment.This is related to, but distinct from, #30567 which requests pre-built wheels. This issue focuses on a specific build-from-source failure.
Steps/Code to Reproduce
Environment Setup:
pacman -Syu
.CLANGARM64
shell launched.pacman -S mingw-w64-clang-aarch64-<package>
):python
(3.12.x)clang
(20.1.1)flang
(20.1.1)meson
(1.7.0)ninja
(1.12.1)pkgconf
openblas
lapack
openssl
hdf5
rust
zlib
/home/user/project
) and WSL interop path (//wsl.localhost/Ubuntu/...
) - error persists in both.Python Virtual Environment:
Environment Variables: Before attempting install, set the following in the activated CLANGARM64 shell:
Attempt Installation:
python -m pip install --verbose scikit-learn==1.6.1 # (Or use `pip install -r requirements.txt` containing scikit-learn==1.6.1)
Expected Results
Scikit-learn==1.6.1 should build and install successfully, similar to how NumPy and SciPy do in the same configured environment.
Actual Results
The build process starts, Meson correctly identifies
clang
, dependencies are resolved, Cython files are processed, but compilation fails during the Ninja execution phase.The key error message is:
(Note: The exact file being compiled just before the error ([48/251] in the log provided previously) might vary slightly, but the
ninja: error: mkdir(...)
is consistent).full log
full error trace
Collapsible until here.
(Cannot run
sklearn.show_versions()
as installation failed)Possible Cause:
The most likely cause is either hitting a path length limit within one of the build tools (Ninja?) despite OS support, or a bug in handling paths containing multiple dots or specific patterns like
.pyd.p
within the MSYS2 Clang toolchain environment on Windows ARM64.Thanks for looking into this! Building natively on Win ARM64 is becoming increasingly relevant. I thought this was a good place to start to gather any insights on the issue.
The text was updated successfully, but these errors were encountered: