diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
commit | e6918187568dbd01842d8d1d2c808ce16a894239 (patch) | |
tree | 64f88b554b444a49f656b6c656111a145cbbaa28 /src/arrow/python/examples/minimal_build | |
parent | Initial commit. (diff) | |
download | ceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip |
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/arrow/python/examples/minimal_build')
5 files changed, 345 insertions, 0 deletions
diff --git a/src/arrow/python/examples/minimal_build/Dockerfile.fedora b/src/arrow/python/examples/minimal_build/Dockerfile.fedora new file mode 100644 index 000000000..7dc329193 --- /dev/null +++ b/src/arrow/python/examples/minimal_build/Dockerfile.fedora @@ -0,0 +1,31 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +FROM fedora:31 + +RUN dnf update -y && \ + dnf install -y \ + autoconf \ + gcc \ + gcc-g++ \ + git \ + wget \ + make \ + cmake \ + ninja-build \ + python3-devel \ + python3-virtualenv
\ No newline at end of file diff --git a/src/arrow/python/examples/minimal_build/Dockerfile.ubuntu b/src/arrow/python/examples/minimal_build/Dockerfile.ubuntu new file mode 100644 index 000000000..d7b84085e --- /dev/null +++ b/src/arrow/python/examples/minimal_build/Dockerfile.ubuntu @@ -0,0 +1,38 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +FROM ubuntu:bionic + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update -y -q && \ + apt-get install -y -q --no-install-recommends \ + apt-transport-https \ + software-properties-common \ + wget && \ + apt-get install -y -q --no-install-recommends \ + build-essential \ + cmake \ + git \ + ninja-build \ + python3-dev \ + python3-pip && \ + apt-get clean && rm -rf /var/lib/apt/lists* + +RUN pip3 install wheel && \ + pip3 install -U setuptools && \ + pip3 install wheel virtualenv
\ No newline at end of file diff --git a/src/arrow/python/examples/minimal_build/README.md b/src/arrow/python/examples/minimal_build/README.md new file mode 100644 index 000000000..9803e18aa --- /dev/null +++ b/src/arrow/python/examples/minimal_build/README.md @@ -0,0 +1,73 @@ +<!--- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> + +# Minimal Python source build on Linux + +This directory shows how to bootstrap a local build from source on Linux with +an eye toward maximum portability across different Linux distributions. This +may help for contributors debugging build issues caused by their local +environments. + +## Fedora 31 + +First, build the Docker image using: +``` +docker build -t arrow_fedora_minimal -f Dockerfile.fedora . +``` + +Then build PyArrow with conda or pip/virtualenv, respectively: +``` +# With pip/virtualenv +docker run --rm -t -i -v $PWD:/io arrow_fedora_minimal /io/build_venv.sh + +# With conda +docker run --rm -t -i -v $PWD:/io arrow_fedora_minimal /io/build_conda.sh +``` + +## Ubuntu 18.04 + +First, build the Docker image using: +``` +docker build -t arrow_ubuntu_minimal -f Dockerfile.ubuntu . +``` + +Then build PyArrow with conda or pip/virtualenv, respectively: +``` +# With pip/virtualenv +docker run --rm -t -i -v $PWD:/io arrow_ubuntu_minimal /io/build_venv.sh + +# With conda +docker run --rm -t -i -v $PWD:/io arrow_ubuntu_minimal /io/build_conda.sh +``` + +## Building on Fedora - Podman and SELinux + +In addition to using Podman instead of Docker, you need to specify `:Z` +for SELinux relabelling when binding a volume. + +First, build the image using: +``` +podman build -t arrow_fedora_minimal -f Dockerfile.fedora +``` + +Then build PyArrow with pip/virtualenv: +``` +# With pip/virtualenv +podman run --rm -i -v $PWD:/io:Z -t arrow_fedora_minimal /io/build_venv.sh +``` diff --git a/src/arrow/python/examples/minimal_build/build_conda.sh b/src/arrow/python/examples/minimal_build/build_conda.sh new file mode 100755 index 000000000..416cac0a7 --- /dev/null +++ b/src/arrow/python/examples/minimal_build/build_conda.sh @@ -0,0 +1,119 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +set -e + +#---------------------------------------------------------------------- +# Change this to whatever makes sense for your system + +HOME= +MINICONDA=$HOME/miniconda-for-arrow +LIBRARY_INSTALL_DIR=$HOME/local-libs +CPP_BUILD_DIR=$HOME/arrow-cpp-build +ARROW_ROOT=/arrow +PYTHON=3.7 + +git clone https://github.com/apache/arrow.git /arrow + +#---------------------------------------------------------------------- +# Run these only once + +function setup_miniconda() { + MINICONDA_URL="https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh" + wget -O miniconda.sh $MINICONDA_URL + bash miniconda.sh -b -p $MINICONDA + rm -f miniconda.sh + LOCAL_PATH=$PATH + export PATH="$MINICONDA/bin:$PATH" + + conda update -y -q conda + conda config --set auto_update_conda false + conda info -a + + conda config --set show_channel_urls True + conda config --add channels https://repo.continuum.io/pkgs/free + conda config --add channels conda-forge + + conda create -y -n pyarrow-$PYTHON -c conda-forge \ + --file arrow/ci/conda_env_unix.txt \ + --file arrow/ci/conda_env_cpp.txt \ + --file arrow/ci/conda_env_python.txt \ + compilers \ + python=3.7 \ + pandas + + export PATH=$LOCAL_PATH +} + +setup_miniconda + +#---------------------------------------------------------------------- +# Activate conda in bash and activate conda environment + +. $MINICONDA/etc/profile.d/conda.sh +conda activate pyarrow-$PYTHON +export ARROW_HOME=$CONDA_PREFIX + +#---------------------------------------------------------------------- +# Build C++ library + +mkdir -p $CPP_BUILD_DIR +pushd $CPP_BUILD_DIR + +cmake -GNinja \ + -DCMAKE_BUILD_TYPE=DEBUG \ + -DCMAKE_INSTALL_PREFIX=$ARROW_HOME \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DARROW_FLIGHT=ON \ + -DARROW_WITH_BZ2=ON \ + -DARROW_WITH_ZLIB=ON \ + -DARROW_WITH_ZSTD=ON \ + -DARROW_WITH_LZ4=ON \ + -DARROW_WITH_SNAPPY=ON \ + -DARROW_WITH_BROTLI=ON \ + -DARROW_PARQUET=ON \ + -DARROW_PLASMA=ON \ + -DARROW_PYTHON=ON \ + $ARROW_ROOT/cpp + +ninja install + +popd + +#---------------------------------------------------------------------- +# Build and test Python library +pushd $ARROW_ROOT/python + +rm -rf build/ # remove any pesky pre-existing build directory + +export PYARROW_BUILD_TYPE=Debug +export PYARROW_CMAKE_GENERATOR=Ninja +export PYARROW_WITH_FLIGHT=1 +export PYARROW_WITH_PARQUET=1 + +# You can run either "develop" or "build_ext --inplace". Your pick + +# python setup.py build_ext --inplace +python setup.py develop + +# git submodules are required for unit tests +git submodule update --init +export PARQUET_TEST_DATA="$ARROW_ROOT/cpp/submodules/parquet-testing/data" +export ARROW_TEST_DATA="$ARROW_ROOT/testing/data" + +py.test pyarrow diff --git a/src/arrow/python/examples/minimal_build/build_venv.sh b/src/arrow/python/examples/minimal_build/build_venv.sh new file mode 100755 index 000000000..f92f4af3e --- /dev/null +++ b/src/arrow/python/examples/minimal_build/build_venv.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +set -e + +#---------------------------------------------------------------------- +# Change this to whatever makes sense for your system + +WORKDIR=${WORKDIR:-$HOME} +MINICONDA=$WORKDIR/miniconda-for-arrow +LIBRARY_INSTALL_DIR=$WORKDIR/local-libs +CPP_BUILD_DIR=$WORKDIR/arrow-cpp-build +ARROW_ROOT=$WORKDIR/arrow +export ARROW_HOME=$WORKDIR/dist +export LD_LIBRARY_PATH=$ARROW_HOME/lib:$LD_LIBRARY_PATH + +virtualenv $WORKDIR/venv +source $WORKDIR/venv/bin/activate + +git clone https://github.com/apache/arrow.git $ARROW_ROOT + +pip install -r $ARROW_ROOT/python/requirements-build.txt \ + -r $ARROW_ROOT/python/requirements-test.txt + +#---------------------------------------------------------------------- +# Build C++ library + +mkdir -p $CPP_BUILD_DIR +pushd $CPP_BUILD_DIR + +cmake -GNinja \ + -DCMAKE_BUILD_TYPE=DEBUG \ + -DCMAKE_INSTALL_PREFIX=$ARROW_HOME \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DARROW_WITH_BZ2=ON \ + -DARROW_WITH_ZLIB=ON \ + -DARROW_WITH_ZSTD=ON \ + -DARROW_WITH_LZ4=ON \ + -DARROW_WITH_SNAPPY=ON \ + -DARROW_WITH_BROTLI=ON \ + -DARROW_PARQUET=ON \ + -DARROW_PYTHON=ON \ + $ARROW_ROOT/cpp + +ninja install + +popd + +#---------------------------------------------------------------------- +# Build and test Python library +pushd $ARROW_ROOT/python + +rm -rf build/ # remove any pesky pre-existing build directory + +export PYARROW_BUILD_TYPE=Debug +export PYARROW_CMAKE_GENERATOR=Ninja +export PYARROW_WITH_PARQUET=1 + +# You can run either "develop" or "build_ext --inplace". Your pick + +# python setup.py build_ext --inplace +python setup.py develop + +# git submodules are required for unit tests +git submodule update --init +export PARQUET_TEST_DATA="$ARROW_ROOT/cpp/submodules/parquet-testing/data" +export ARROW_TEST_DATA="$ARROW_ROOT/testing/data" + +py.test pyarrow |