Spark-shell getting error during login

Hi ,

I am getting following error when trying to login to spark-shell. The same was working fine without issues two days back

[karthikeyanpalanisamy4522@ip-172-31-38-146 ~]$ spark-shell
SPARK_MAJOR_VERSION is set to 2, using Spark2
File “/usr/bin/hdp-select”, line 242
print "ERROR: Invalid package - " + name
^
SyntaxError: Missing parentheses in call to ‘print’. Did you mean print("ERROR: Invalid package - " + name)?
ls: cannot access /usr/hdp//hadoop/lib: No such file or directory
Exception in thread “main” java.lang.IllegalStateException: hdp.version is not set while running Spark under HDP, please set through HDP_VERSION in spark-env.sh or add a java-opts file in conf with -Dhdp.version=xxx
at org.apache.spark.launcher.Main.main(Main.java:118)
[karthikeyanpalanisamy4522@ip-172-31-38-146 ~]$ spark
-bash: spark: command not found