Skip to content

Instantly share code, notes, and snippets.

@AlenkaF
Created October 13, 2021 11:51
Show Gist options
  • Save AlenkaF/93c34cc80b5cb3b3f6643dc03d6a7f45 to your computer and use it in GitHub Desktop.
Save AlenkaF/93c34cc80b5cb3b3f6643dc03d6a7f45 to your computer and use it in GitHub Desktop.
How I tried to build PyArrow
# --- Versions ---
# Xcode: Xcode 13.0, Build version 13A233
# Anaconda:conda 4.10.1
# Python:3.9
# --- Install XCode ---
# Maybe there should be a check if it is installed correctly?
# Haven't found any help online. It was strange that it wasn't able to open the
# Arrow folder at startup.
# --- Cloning Arrow git repo ---
mkdir repos
cd repos
git clone https://github.com/apache/arrow.git
# --- Install Anaconda ---
# --- Create conda env ---
conda create -y -n pyarrow-dev -c conda-forge \
--file arrow/ci/conda_env_unix.txt \
--file arrow/ci/conda_env_cpp.txt \
--file arrow/ci/conda_env_python.txt \
--file arrow/ci/conda_env_gandiva.txt \
compilers \
python=3.9 \
pandas
# --- Pull in test data and setup env vars ---
pushd arrow
git submodule init
git submodule update
export PARQUET_TEST_DATA="${PWD}/cpp/submodules/parquet-testing/data"
export ARROW_TEST_DATA="${PWD}/testing/data"
export ARROW_ROOT="${PWD}"
popd
# --- Installed SDK 10.9 compiler ---
# From: https://docs.conda.io/projects/conda-build/en/latest/resources/compiler-tools.html#macos-sdk
# Info: https://stackoverflow.com/questions/55798166/cmake-fails-with-when-attempting-to-compile-simple-test-program/55798942#55798942
# Needed to change
# > export CONDA_BUILD_SYSROOT=/opt/MacOSX10.9.sdk
# to
# > export CONDA_BUILD_SYSROOT=/Users/alenkafrim/opt/MacOSX10.9.sdk
# Maybe we should add something like this also:
# > clang .. -isysroot ${CONDA_BUILD_SYSROOT} -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET} ..
# --- Activate conda env ---
conda activate pyarrow-dev
export PREFIX="${CONDA_PREFIX}"
export CONDA_BUILD="1"
conda activate pyarrow-dev
# --- Set env vars ---
echo "export ARROW_HOME=\$CONDA_PREFIX"
export ARROW_HOME=$CONDA_PREFIX
echo "export CONDA_BUILD_SYSROOT=/Users/alenkafrim/opt/MacOSX10.9.sdk"
export CONDA_BUILD_SYSROOT=/Users/alenkafrim/opt/MacOSX10.9.sdk
# --- C++ build ---
mkdir arrow/cpp/build
pushd arrow/cpp/build
cmake -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=OFF \
-DARROW_PYTHON=ON \
-DARROW_BUILD_TESTS=ON \
-DARROW_EXTRA_ERROR_CONTEXT=ON\
-DARROW_DEPENDENCY_SOURCE=CONDA \
-DCMAKE_OSX_SYSROOT=${CONDA_BUILD_SYSROOT} \
..
make -j4
make install
popd
# --- pyarrow ---
pushd arrow/python
export PYARROW_WITH_PARQUET=1
python setup.py build_ext --inplace
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment