Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

I have installed the Impala using the CM, but I'm unable to access the impala-shell

I have installed the Impala using the CM, but I'm unable to access the impala-shell

New Contributor

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.

4 REPLIES 4
Highlighted

Re: I have installed the Impala using the CM, but I'm unable to access the impala-shell

New Contributor

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

Re: I have installed the Impala using the CM, but I'm unable to access the impala-shell

New Contributor

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;'

 

Re: I have installed the Impala using the CM, but I'm unable to access the impala-shell

Rising Star

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).

Re: I have installed the Impala using the CM, but I'm unable to access the impala-shell

Master Collaborator

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

Don't have an account?
Coming from Hortonworks? Activate your account here