环境:Mac 10.14.3/ubuntu, python 3.6
使用pip install,安装步骤如下:
(1) pip install six
(2) pip install bit_array
(3) pip install thriftpy
(4) pip install thrift_sasl == 0.2.1
(5) pip install impyla
其中,在安装第四步的时候报错如下:
warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
sasl/saslwrapper.cpp:249:10: fatal error: 'string' file not found
#include <string>
^~~~~~~~
1 warning and 1 error generated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command "/Users/sfeng/anaconda3/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/q6/3_gw4_896pn8wp8zkmcgj5t80000gn/T/pip-install-xcm44ntt/sasl/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/q6/3_gw4_896pn8wp8zkmcgj5t80000gn/T/pip-record-ecbkx1qf/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/q6/3_gw4_896pn8wp8zkmcgj5t80000gn/T/pip-install-xcm44ntt/sasl/
解决方法为:
pip install git+https://github.com/JoshRosen/python-sasl.git@fix-build-with-newer-xcode
然后重新安装thrift_sasl即可。
第4步还可能出现以下错误:
解决方法:
apt-get install libsasl2-dev
然后重新安装thrift_sasl即可。
参考:
python 安装impala包
如何使用Python Impyla客户端连接Hive和Impala
Pip install fails on OS X Mojave #15
sasl/saslwrapper.h:22:23: fatal error: sasl/sasl.h: No such file or directory
#############Mac与Ubuntu的分割线###################
Ubuntu连接impala出现的问题:
可能相关的依赖包的版本如下:
ubuntu版本:16.04.6
six: 1.11.0
bitarray: 0.8.1
thriftpy: 0.3.9
thrift_sasl: 0.2.1
impyla: 0.13.8
出现的问题:
thriftpy.transport.TTransportException: TTransportException(type=1, message="Could not start SASL: b'Error in sasl_client_start (-4) SASL(-4): no mechanism available: No worthy mechs found'")
解决方法如下:
apt-get install libsasl2-dev libsasl2-2 libsasl2-modules-gssapi-mit
参考:
SASL Error: no mechanism available: No worthy mechs found