Skip to content

Commit 987863d

Browse files
authored
Clean up lightgbm install and fix build (#1488)
Bumping up the base image version to the latest. Good news, Colab installs lightgbm on both CPU and GPU, Bad news seems like the way they installed the package seems to give issues. I assume they install lightgbm in a similar manner to us, build the wheel and install in a tmp folder. UV PIP doesn't like this and errors at install requirement file step: error: Distribution not found at: file:///tmp/lightgbm/LightGBM/dist/lightgbm-4.5.0-py3-none-linux_x86_64.whl Removing our pin on the package fixes the build. I could also introduce a pin for lightgbm, but this could be problematic, as we'll continuously have to update the pining.
1 parent ddcafd2 commit 987863d

File tree

4 files changed

+3
-76
lines changed

4 files changed

+3
-76
lines changed

Dockerfile.tmpl

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
11
ARG BASE_IMAGE \
2-
BASE_IMAGE_TAG \
3-
LIGHTGBM_VERSION
2+
BASE_IMAGE_TAG
43

5-
{{ if eq .Accelerator "gpu" }}
6-
FROM gcr.io/kaggle-images/python-lightgbm-whl:${BASE_IMAGE_TAG}-${LIGHTGBM_VERSION} AS lightgbm_whl
7-
{{ end }}
84
FROM ${BASE_IMAGE}:${BASE_IMAGE_TAG}
95

10-
#b/415358342: UV reports missing requirements files https://github.com/googlecolab/colabtools/issues/5237
11-
ENV UV_CONSTRAINT= \
12-
UV_BUILD_CONSTRAINT=
13-
146
ADD kaggle_requirements.txt /kaggle_requirements.txt
157

168
# Freeze existing requirements from base image for critical packages:
17-
RUN pip freeze | grep -E 'tensorflow|keras|torch|jax|lightgbm' > /colab_requirements.txt
9+
RUN pip freeze | grep -E 'tensorflow|keras|torch|jax' > /colab_requirements.txt
1810

1911
# Merge requirements files:
2012
RUN cat /colab_requirements.txt >> /requirements.txt
@@ -67,17 +59,6 @@ ARG PACKAGE_PATH=/usr/local/lib/python3.11/dist-packages
6759
# Install GPU-specific non-pip packages.
6860
{{ if eq .Accelerator "gpu" }}
6961
RUN uv pip install --system "pycuda"
70-
71-
# b/381256047 Remove once installed in Colabs base image.
72-
# Install LightGBM
73-
COPY --from=lightgbm_whl /tmp/whl/*.whl /tmp/lightgbm/
74-
# Install OpenCL (required by LightGBM GPU version)
75-
RUN apt-get install -y ocl-icd-libopencl1 clinfo && \
76-
mkdir -p /etc/OpenCL/vendors && \
77-
echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd && \
78-
uv pip install --system /tmp/lightgbm/*.whl && \
79-
rm -rf /tmp/lightgbm && \
80-
/tmp/clean-layer.sh
8162
{{ end }}
8263

8364

Jenkinsfile

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,6 @@ pipeline {
2121
}
2222

2323
stages {
24-
stage('Pre-build Packages from Source') {
25-
stages {
26-
stage('lightgbm') {
27-
options {
28-
timeout(time: 10, unit: 'MINUTES')
29-
}
30-
steps {
31-
sh '''#!/bin/bash
32-
set -exo pipefail
33-
source config.txt
34-
cd packages/
35-
./build_package --base-image $BASE_IMAGE:$BASE_IMAGE_TAG \
36-
--package lightgbm \
37-
--version $LIGHTGBM_VERSION \
38-
--build-arg CUDA_MAJOR_VERSION=$CUDA_MAJOR_VERSION \
39-
--build-arg CUDA_MINOR_VERSION=$CUDA_MINOR_VERSION \
40-
--push
41-
'''
42-
}
43-
}
44-
}
45-
}
46-
4724
stage('Build/Test/Diff') {
4825
parallel {
4926
stage('CPU') {

config.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
BASE_IMAGE=us-docker.pkg.dev/colab-images/public/runtime
2-
BASE_IMAGE_TAG=release-colab_20250404-060113_RC00
3-
LIGHTGBM_VERSION=4.6.0
2+
BASE_IMAGE_TAG=release-colab_20250603-060055_RC00
43
CUDA_MAJOR_VERSION=12
54
CUDA_MINOR_VERSION=5

packages/lightgbm.Dockerfile

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)