【发布时间】:2021-11-16 14:34:28
【问题描述】:
我使用来自piwheels 的包为armv7 架构构建了一个带有python 包numpy、scipy、pandas 和google-cloud-bigquery 的Docker 映像。基础镜像是Python:3.7-buster。
如果我使用此映像运行容器,容器总是会重新启动并给我错误日志“ValueError:此方法需要安装 pyarrow”:
Traceback (most recent call last):
File "main_prog.py", line 3, in <module>
upload_data()
File "/usr/src/app/bigquery.py", line 39, in upload_data
job = client.load_table_from_dataframe(dataframe, table_id, job_config=job_config) # Make an API request.
File "/usr/local/lib/python3.7/site-packages/google/cloud/bigquery/client.py", line 2574, in load_table_from_dataframe
raise ValueError("This method requires pyarrow to be installed")
ValueError: This method requires pyarrow to be installed
所以我尝试直接在我的 Dockerfile 中安装pyarrow:
RUN pip3 install pyarrow
这给了我错误“错误:无法为使用 PEP 517 且无法直接安装的 pyarrow 构建轮子”:
> [10/11] RUN pip3 install pyarrow:
#14 164.9 copying pyarrow/tests/parquet/test_parquet_writer.py -> build/lib.linux-armv7l-3.7/pyarrow/tests/parquet
#14 164.9 running build_ext
#14 164.9 creating /tmp/pip-install-jiim0m92/pyarrow_07d2ad5142d7405fa1b4bb2fe83e0428/build/temp.linux-armv7l-3.7
#14 164.9 -- Running cmake for pyarrow
#14 164.9 cmake -DPYTHON_EXECUTABLE=/usr/local/bin/python -DPython3_EXECUTABLE=/usr/local/bin/python -DPYARROW_BUILD_CUDA=off -DPYARROW_BUILD_FLIGHT=off -DPYARROW_BUILD_GANDIVA=off -DPYARROW_BUILD_DATASET=off -DPYARROW_BUILD_ORC=off -DPYARROW_BUILD_PARQUET=off -DPYARROW_BUILD_PLASMA=off -DPYARROW_BUILD_S3=off -DPYARROW_BUILD_HDFS=off -DPYARROW_USE_TENSORFLOW=off -DPYARROW_BUNDLE_ARROW_CPP=off -DPYARROW_BUNDLE_BOOST=off -DPYARROW_GENERATE_COVERAGE=off -DPYARROW_BOOST_USE_SHARED=on -DPYARROW_PARQUET_USE_SHARED=on -DCMAKE_BUILD_TYPE=release /tmp/pip-install-jiim0m92/pyarrow_07d2ad5142d7405fa1b4bb2fe83e0428
#14 164.9 error: command 'cmake' failed with exit status 1
#14 164.9 ----------------------------------------
#14 164.9 ERROR: Failed building wheel for pyarrow
#14 164.9 Failed to build pyarrow
#14 164.9 ERROR: Could not build wheels for pyarrow which use PEP 517 and cannot be installed directly
然后喜欢它推荐的here我试过了:
RUN pip3 install pandas-gbq==0.14.0
和
RUN pip install --upgrade 'google-cloud-bigquery[bqstorage,pandas]'
但没有任何效果,每次我遇到与上述相同的错误。
我在piwheels 和PyPi 上都找不到armv7 的pyarrow 轮子。
有人知道答案吗?感谢您的帮助!
【问题讨论】:
-
据我所知,pyarrow 没有为 arm7 发布轮子(它为 arm64 发布)。您可以尝试使用 conda 而不是 pip 安装(我也不确定它是否是受支持的版本)。如果这些都不起作用,您可能不得不尝试从源代码构建 pyarrow。
-
是的,我已经尝试过了here。但这没有用,这就是为什么我用 pywheels 尝试它的原因。
标签: python-3.x google-bigquery dockerfile pyarrow armv7