Skip to content

Commit 260fef9

Browse files
committed
GH-47371: [Python] Fix installation of Numba-CUDA in CI environment
As per the Numba-CUDA docs, `numba-cuda` should be installed with a variant depending on the CUDA version. Failing to specify the variant leads to `numba-cuda` being installed without the CUDA toolkit wheels that it needs. This commit adds the variant specifier to the installation. I think Arrow is using CUDA 11.7 in CI images, so I've changed the Numba-CUDA version to 0.18.1, which is the last version to support CUDA 11 (the Numba-CUDA policy is to support all minor versions within the last two major versions of CUDA). IF Arrow moves to CUDA 12 for CI images, this could be changed back to `latest` in future. Numba-CUDA installation docs: https://nvidia.github.io/numba-cuda/user/installation.html
1 parent 69d2487 commit 260fef9

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ LLVM=18
6767
MAVEN=3.8.7
6868
NODE=20
6969
NUMBA=latest
70-
NUMBA_CUDA=latest
70+
NUMBA_CUDA=0.18.1
7171
NUMPY=latest
7272
PANDAS=latest
7373
PYTHON=3.9

ci/docker/linux-apt-python-3.dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ RUN python3 -m venv ${ARROW_PYTHON_VENV} && \
3333

3434
ARG numba
3535
ARG numba_cuda
36+
ARG cuda
3637
COPY ci/scripts/install_numba.sh /arrow/ci/scripts/
3738
RUN if [ "${numba}" != "" ]; then \
38-
/arrow/ci/scripts/install_numba.sh ${numba} ${numba_cuda} \
39+
/arrow/ci/scripts/install_numba.sh ${numba} ${numba_cuda} ${cuda} \
3940
; fi
4041

4142
ENV ARROW_ACERO=ON \

ci/scripts/install_numba.sh

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
set -e
2121

22-
if [ "$#" -ne 1 ] && [ "$#" -ne 2 ]; then
23-
echo "Usage: $0 <numba version> [numba-cuda version]"
22+
if [ "$#" -ne 1 ] && [ "$#" -ne 2 ] && [ "$#" -ne 3 ]; then
23+
echo "Usage: $0 <numba version> [numba-cuda version] [cuda version]"
2424
exit 1
2525
fi
2626

@@ -48,10 +48,21 @@ fi
4848

4949
numba_cuda=$2
5050

51+
if [ "$#" -eq 3 ]; then
52+
cuda=$3
53+
else
54+
# Default to CUDA 11
55+
cuda=11
56+
fi
57+
58+
# Variants are cu11, cu12, etc. depending on CUDA version
59+
variant="cu${cuda%%.*}"
60+
5161
if [ "${numba_cuda}" = "master" ]; then
52-
pip install https://github.com/NVIDIA/numba-cuda/archive/main.tar.gz#egg=numba-cuda
62+
pip install "numba-cuda[$variant] @ https://github.com/NVIDIA/numba-cuda/archive/main.tar.gz"
5363
elif [ "${numba_cuda}" = "latest" ]; then
54-
pip install numba-cuda
64+
pip install numba-cuda[$variant]
5565
else
56-
pip install "numba-cuda==${numba_cuda}"
66+
echo installing for $variant
67+
pip install "numba-cuda[$variant]==${numba_cuda}"
5768
fi

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,7 @@ services:
966966
base: ${REPO}:${ARCH}-ubuntu-${UBUNTU}-cuda-${CUDA}-cpp
967967
numba: ${NUMBA}
968968
numba_cuda: ${NUMBA_CUDA}
969+
cuda: ${CUDA}
969970
shm_size: *shm-size
970971
environment:
971972
<<: [*common, *ccache, *sccache]

0 commit comments

Comments
 (0)