Python pip install pyarrow 报错,无法执行'cmake'

问题描述 投票:0回答:5

我正在尝试在我的 EMR 集群的主实例上安装 pyarrow,但是我总是收到此错误。

[hadoop@ip-XXX-XXX-XXX-XXX ~]$ sudo /usr/bin/pip-3.4 install pyarrow
Collecting pyarrow
Downloading https://files.pythonhosted.org/packages/c0/a0/f7e9dfd8988d94f4952f9b50eb04e14a80fbe39218520725aab53daab57c/pyarrow-0.10.0.tar.gz (2.1MB)
100% |████████████████████████████████| 2.2MB 643kB/s 
Requirement already satisfied: numpy>=1.10 in /usr/local/lib64/python3.4/site-packages (from pyarrow)
Requirement already satisfied: six>=1.0.0 in /usr/local/lib/python3.4/site-packages (from pyarrow)
Installing collected packages: pyarrow
Running setup.py install for pyarrow ... error
Complete output from command /usr/bin/python3.4 -u -c "import setuptools, tokenize;__file__='/mnt/tmp/pip-build-pr3y5_mu/pyarrow/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-vmywdpeg-record/install-record.txt --single-version-externally-managed --compile:
/usr/lib64/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
/mnt/tmp/pip-build-pr3y5_mu/pyarrow/.eggs/setuptools_scm-3.1.0-py3.4.egg/setuptools_scm/utils.py:118: UserWarning: 'git' was not found
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.4
creating build/lib.linux-x86_64-3.4/pyarrow
copying pyarrow/pandas_compat.py -> build/lib.linux-x86_64-3.4/pyarrow
copying pyarrow/serialization.py -> build/lib.linux-x86_64-3.4/pyarrow
......
creating build/lib.linux-x86_64-3.4/pyarrow/tests/data
copying pyarrow/tests/data/v0.7.1.all-named-index.parquet -> build/lib.linux-x86_64-3.4/pyarrow/tests/data
copying pyarrow/tests/data/v0.7.1.column-metadata-handling.parquet -> build/lib.linux-x86_64-3.4/pyarrow/tests/data
copying pyarrow/tests/data/v0.7.1.parquet -> build/lib.linux-x86_64-3.4/pyarrow/tests/data
copying pyarrow/tests/data/v0.7.1.some-named-index.parquet -> build/lib.linux-x86_64-3.4/pyarrow/tests/data
running build_ext
creating build/temp.linux-x86_64-3.4
-- Runnning cmake for pyarrow
cmake -DPYTHON_EXECUTABLE=/usr/bin/python3.4  -DPYARROW_BOOST_USE_SHARED=on -DCMAKE_BUILD_TYPE=release /mnt/tmp/pip-build-pr3y5_mu/pyarrow
unable to execute 'cmake': No such file or directory
error: command 'cmake' failed with exit status 1

----------------------------------------
Command "/usr/bin/python3.4 -u -c "import setuptools, tokenize;__file__='/mnt/tmp/pip-build-pr3y5_mu/pyarrow/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-vmywdpeg-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /mnt/tmp/pip-build-pr3y5_mu/pyarrow/

我不知道为什么它说'command 'cmake' failed with exit status 1',事实上可以肯定的是,我预装了cmake,但我仍然得到这个错误。此外,我可以毫无问题地执行 sudo pip install pyarrow,但是在使用 sudo pip-3.4 install pyarrow 时出现错误。我是不是遗漏了什么或者这个错误可能与 cmake 无关?我会很感激任何帮助。

python-3.x cmake pip amazon-emr pyarrow
5个回答
25
投票

对我来说(在 linux 上)问题是 pip 版本太旧

pip --version
> pip 18.1

根据arrow.apache.org太低了:

在 Linux 上,您需要 pip >= 19.0 来检测预构建的二进制文件 包裹。

升级

pip
到最新版本,这对我有用:

pip install --upgrade pip

但对您来说可能有所不同,请参阅此线程以了解其他升级方法

pip
.


17
投票

最后,我找到了一种解决这种情况的方法,方法是安装早期版本的 pyarrow。我试图安装失败的 pyarrow-0.10.0。但是如果我安装的是 pyarrow-0.9.0,它就可以工作。所以我认为 cmake 和 pyarrow-0.10.0. 之间可能存在一些兼容问题


0
投票

使用带有 pip 的

--no-use-pep517
开关对我有用。 (使用 Debian 11、Python 3.11、pip 22.3.1)

根据我的理解,pip 尝试使用 PEP-517 并从源代码构建 pyarrow。

当我尝试时,最初 cmake 失败了。一旦我通过

apt-get install cmake
安装了它,我就会收到另一个关于Arrow没有被安装的错误。然后我从一些GitHub问题中发现了
--no-use-pep517

一些提及此解决方法的票证:


0
投票

(MacOS) 我在 python3.11 虚拟环境中安装 pyarrow 和 snowflake-connector-python 错误消息是:

Python pip install pyarrow 报错,无法执行'cmake'

使用python3.9环境解决

python3.9 -m venv myvenv


-5
投票

似乎 pyarrow 与 cmake 和 pip 有问题。

你可以使用 conda 代替 pip。

conda 安装-c conda-forge pyarrow

© www.soinside.com 2019 - 2024. All rights reserved.