scikit-learn / scikit-learn

scikit-learn: machine learning in Python
https://scikit-learn.org
BSD 3-Clause "New" or "Revised" License
60.02k stars 25.39k forks source link

issue in building from source with Windows64 Python 3.12.7 #30195

Open fengluoqiuwu opened 3 days ago

fengluoqiuwu commented 3 days ago

Describe the bug

I am currently following the guide on building from source to create an editable build of scikit-learn. However, I encountered some errors during the process. Any help is highly appriciated.

Steps/Code to Reproduce

pip install wheel numpy scipy cython meson-python ninja
$env:DISTUTILS_USE_SDK = "1"  
& "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
pip install --editable . --verbose --no-build-isolation --config-settings editable-verbose=true 

Expected Results

No error is thrown.

Actual Results

[146/251] Compiling C object sklearn/_loss/_loss.cp312-win_amd64.pyd.p/meson-generated_sklearn__loss__loss.pyx.c.obj
  ninja: build stopped: subcommand failed.
  Activating VS 17.11.2
  INFO: automatically activated MSVC compiler environment
  INFO: autodetecting backend as ninja
  INFO: calculating backend command to run: C:\Users\Eden_\Desktop\Coder\MachineLearning\scikit-learn\.venv/Scripts\ninja.EXE
  error: subprocess-exited-with-error

  × Preparing editable metadata (pyproject.toml) 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.
  full command: 'C:\Users\Eden_\Desktop\Coder\MachineLearning\scikit-learn\.venv\Scripts\python.exe' 'C:\Users\Eden_\Desktop\Coder\MachineLearning\scikit-learn\.venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py' prepare_metadata_for_build_editable 'C:\Users\Eden_\AppData\Local\Temp\tmpxaql9nw9'
  cwd: C:\Users\Eden_\Desktop\Coder\MachineLearning\scikit-learn
  Preparing editable metadata (pyproject.toml) ... error
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

[notice] A new release of pip is available: 23.2.1 -> 24.3.1
[notice] To update, run: python.exe -m pip install --upgrade pip

Versions

python : '3.12.7 (tags/v3.12.7:0b05ead, Oct  1 2024, 03:06:41) [MSC v.1941 64 bit (AMD64)]'
scikit-learn: the latest source code. Unable to obtain the latest source code due to installation issues.
adrinjalali commented 1 day ago

@jeremiedbb might have an idea here. I don't have/use windows. If you're trying to contribute to the project from windows, we strongly recommend using WSL2.

It might also be an issue with pip since yours is old.

fengluoqiuwu commented 20 hours ago

It might also be an issue with pip since yours is old.

I've upgrade the pip and rebuild it, but get same error.