Search code examples
pythonwindows-10huesaslpyhive

SASL error when trying to connect to hive(hue) by python from my PC - Windows10


Need your help!
I read all the documentation that I found on the internet (StackOverflow, Github, etc.), but nothing helped.
I am trying to connect to hive(hue) by python from my PC, my script is:

enter image description here

When I run this code I got this error message:

 Traceback (most recent call last):
 File "C:/Users/myuser/Documents/Python/testing.py", line 6, in <module>
 cursor = hive.connect('myconnect', port=10000, username='root').cursor()
 File "C:\Users\myuser\AppData\Local\Continuum\anaconda3\lib\site-packages\pyhive\hive.py", line 94, 
 in connect
 return Connection(*args, **kwargs)
 File "C:\Users\myuser\AppData\Local\Continuum\anaconda3\lib\site-packages\pyhive\hive.py", line 
 192, in __init__self._transport.open()File 
 "C:\Users\myuser\AppData\Local\Continuum\anaconda3\lib\site-packages\thrift_sasl\__init__.py", line 
 79, in open message=("Could not start SASL: %s" % self.sasl.getError()))
 thrift.transport.TTransport.TTransportException: Could not start SASL: b'Error in sasl_client_start 
 (-4) SASL(-4): no mechanism available: Unable to find a callback: 2'

My system detailes:

OS: Windows 10 Pro
Python version: Python 3.7.4
Distribution: Anaconda, Inc. on win32


Solution

  • I found a way to work around the problem.

    Actions taken:

    1. Installed VirtualBox with Ubuntu OS on my PC.
    2. Run Ubuntu as root.
    3. Installed python, pip3 and the relevant libraries(pyhive, sasl, thrift_sasl, and thrift)
    4. Run my code - works great!

    My conclusion that my problem caused due to security(I am not an admin on my station) and windows issues.