Skip to content

Commit d541c7f

Browse files
authored
Fix: Pyarrow Issue for s390x (#2503)
Signed-off-by: Nishan Acharya <[email protected]>
1 parent 77ed18c commit d541c7f

File tree

1 file changed

+35
-12
lines changed

1 file changed

+35
-12
lines changed

runtimes/datascience/ubi9-python-3.12/Dockerfile.cpu

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -104,42 +104,65 @@ ARG TARGETARCH
104104
USER 0
105105
WORKDIR /tmp/build-wheels
106106

107+
# Set pyarrow version for s390x
108+
RUN if [ "$TARGETARCH" = "s390x" ]; then \
109+
echo 'export PYARROW_VERSION=17.0.0' >> /etc/profile.d/s390x.sh; \
110+
fi
111+
107112
# Build pyarrow optimized for s390x
108113
RUN --mount=type=cache,target=/root/.cache/pip \
109114
--mount=type=cache,target=/root/.cache/dnf \
110115
if [ "$TARGETARCH" = "s390x" ]; then \
111-
# Install build dependencies (shared for pyarrow and onnx)
112-
dnf install -y cmake make gcc-c++ pybind11-devel wget && \
116+
# Install build dependencies
117+
dnf install -y cmake make gcc-c++ pybind11-devel wget git \
118+
openssl-devel zlib-devel bzip2-devel lz4-devel \
119+
ninja-build && \
113120
dnf clean all && \
114-
# Build and collect pyarrow wheel
115-
git clone --depth 1 https://github.com/apache/arrow.git && \
116-
cd arrow/cpp && \
117-
mkdir release && cd release && \
121+
# Source the environment variables
122+
source /etc/profile.d/s390x.sh && \
123+
# Clone specific version of arrow
124+
git clone -b apache-arrow-${PYARROW_VERSION} https://github.com/apache/arrow.git && \
125+
cd arrow && \
126+
# Set environment variables for build
127+
export ARROW_HOME=/usr/local && \
128+
export LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib:$LD_LIBRARY_PATH && \
129+
export PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \
130+
# Build C++ library first
131+
cd cpp && \
132+
mkdir build && cd build && \
118133
cmake -DCMAKE_BUILD_TYPE=Release \
119-
-DCMAKE_INSTALL_PREFIX=/usr/local \
134+
-DCMAKE_INSTALL_PREFIX=$ARROW_HOME \
120135
-DARROW_PYTHON=ON \
121136
-DARROW_PARQUET=ON \
122137
-DARROW_ORC=ON \
123138
-DARROW_FILESYSTEM=ON \
124139
-DARROW_JSON=ON \
125140
-DARROW_CSV=ON \
126141
-DARROW_DATASET=ON \
127-
-DARROW_DEPENDENCY_SOURCE=BUNDLED \
128-
-DARROW_WITH_LZ4=OFF \
129-
-DARROW_WITH_ZSTD=OFF \
142+
-DARROW_WITH_LZ4=ON \
143+
-DARROW_WITH_ZSTD=ON \
130144
-DARROW_WITH_SNAPPY=OFF \
145+
-DARROW_WITH_BZ2=ON \
146+
-DARROW_WITH_ZLIB=ON \
131147
-DARROW_BUILD_TESTS=OFF \
132148
-DARROW_BUILD_BENCHMARKS=OFF \
149+
-DARROW_USE_CCACHE=OFF \
150+
-GNinja \
133151
.. && \
134-
make -j$(nproc) VERBOSE=1 && \
135-
make install -j$(nproc) && \
152+
ninja install && \
136153
cd ../../python && \
154+
# Install Python build requirements
137155
pip install --no-cache-dir -r requirements-build.txt && \
156+
# Build Python package
138157
PYARROW_WITH_PARQUET=1 \
139158
PYARROW_WITH_DATASET=1 \
140159
PYARROW_WITH_FILESYSTEM=1 \
141160
PYARROW_WITH_JSON=1 \
142161
PYARROW_WITH_CSV=1 \
162+
PYARROW_WITH_LZ4=1 \
163+
PYARROW_WITH_ZSTD=1 \
164+
PYARROW_WITH_BZ2=1 \
165+
PYARROW_BUNDLE_ARROW_CPP=1 \
143166
PYARROW_PARALLEL=$(nproc) \
144167
python setup.py build_ext --build-type=release --bundle-arrow-cpp bdist_wheel && \
145168
mkdir -p /tmp/wheels && \

0 commit comments

Comments
 (0)