Skip to content

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

@jameslamb

Description

@jameslamb

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:

[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)

Reproducible example

This is happening on all PR CI.

I was not able to reproduce it on my M2 Mac like this:

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:

pip install --prefer-binary 'build>=0.10.0'

In CI logs, it does appear to be getting installed

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?

Metadata

Metadata

Assignees

Labels

blockingCI will be unsuccessful until this is resolved.maintenance

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions