ITADN

[ci] [python-package] builds failing: "No module named build"

#7258Openjameslamb 创建于 2026-05-04
blockingmaintenance
J
jameslambcommented
## Description Some time in the last day or 2, many (but not all!) Python CI jobs on macOS and Linux have started failing like this: ```text [INFO] found pre-compiled lib_lightgbm.so [INFO] --- building wheel --- /github/home/miniforge/envs/test-env/bin/python: No module named build ``` ([example build link](https://github.com/lightgbm-org/LightGBM/actions/runs/25298335009/job/74160774900?pr=7249#step:6:5326)) ## Reproducible example This is happening on all PR CI. I was not able to reproduce it on my M2 Mac like this: ```shell export COMPILER=clang export IN_UBUNTU_BASE_CONTAINER=false export SETUP_CONDA=false export TASK=bdist export METHOD=wheel export OS_NAME=macos export PYTHON_VERSION="3.13" export CONDA="${HOME}/miniforge3" export PATH="${CONDA}/bin:${PATH}" export PRODUCES_ARTIFACTS=false export BUILD_DIRECTORY=$(pwd) export BUILD_ARTIFACTSTAGINGDIRECTORY="${BUILD_DIRECTORY}" rm -rf ./{build,dist} conda env remove --yes --name test-env ./.ci/test.sh ``` ## Environment info N/A ## Additional Comments `build` is managed by `build-python.sh` and installed with `pip`: https://github.com/lightgbm-org/LightGBM/blob/9545905b9ade997ee8a06001ff0f4c5e792e3f85/build-python.sh#L188 In CI logs, it does appear to be getting installed ```text Collecting build>=0.10.0 Downloading build-1.5.0-py3-none-any.whl.metadata (5.7 kB) Requirement already satisfied: packaging>=24.0 in /github/home/miniforge/lib/python3.13/site-packages (from build>=0.10.0) (26.2) Collecting pyproject_hooks (from build>=0.10.0) Downloading pyproject_hooks-1.2.0-py3-none-any.whl.metadata (1.3 kB) Downloading build-1.5.0-py3-none-any.whl (26 kB) Downloading pyproject_hooks-1.2.0-py3-none-any.whl (10 kB) Installing collected packages: pyproject_hooks, build Successfully installed build-1.5.0 pyproject_hooks-1.2.0 ``` I suspect that this is related to conda environment activation. The scripts are using `source activate`, and maybe some relevant activation variables are not exported and therefore the module can't be found inside the invoked `build-python.sh`? And maybe this is only breaking now because some other dependency in the conda environment happened to be pulling in `python-build` before?
2 条评论