Created 07-30-2015 10:24 PM
I have installed the Impala using the CM, but I'm unable to access the impala-shell , instead its throwing me a syntax error like this
File "/opt/cloudera/parcels/CDH-5.3.2-1.cdh5.3.2.p0.10/bin/../lib/impala-shell/impala_shell.py", line 176
print '\tNo options available.'
^
SyntaxError: Missing parentheses in call to 'print'
I have verified the file in the described location and looks fine because i have compare it with other file from different cluster with same vesrion of CDH.
Created 01-02-2018 06:19 AM
The problem is that impala-shell/impala_shell.py is written for Python 2.7.
The print statement without parameters was deprecated in Python 3.
For Cloudera to fix the problem, they just need to change the line to read
print('\tNo options available.')
You can either hack-up their source code, and fix it;
you can change your conda environment to be 2.7; or,
you can call impala_shell.py directly using /usr/bin/python2
Created 01-19-2018 06:45 AM
Found a nice workaround for this, the "env -i" command creates a new shell without inheriting the environment of your current shell.
env -i impala-shell -k --ssl -i <serverURL> -q 'invalidate metadata;'
Created 03-29-2019 10:34 AM
I would like to offer one additional approach that I believe is easier than those proposed by @sdavis049. Technically, it still falls under the category of altering their source, but in a much less invasive way than actually fixing the print-without-parentheses issue in impala-shell.py.
Instead you can make a copy of `impala-shell`, the shell script that calls the offending python script, and alter the python version used there. The line in question is:
exec python ${SHELL_HOME}/impala_shell.py "$@"
All we need to do is change that to python2
exec python2 ${SHELL_HOME}/impala_shell.py "$@"
So, basically, copy the impala-shell script to somewhere else *earlier* in your PATH (eg. /usr/local/bin, on my system). Then, alter that one line.
Now it doesn't matter what version of conda is active and you do not have to change your usage of impala-shell at all (eg. using env -l).
Created 03-29-2019 10:58 AM
I filed a JIRA with the Apache project so that there's more visibility into this issue:https://issues.apache.org/jira/browse/IMPALA-8373