From d04fe0d3ea55fb8cac418050da1bf3e205a2ac18 Mon Sep 17 00:00:00 2001 From: Jurik-001 <123458520+Jurik-001@users.noreply.github.com> Date: Fri, 25 Aug 2023 07:18:55 +0200 Subject: [PATCH] =?UTF-8?q?remove=20Value=20error=20"pyspark=20is=20not=20?= =?UTF-8?q?installed.=20Please=20install=20it=20with=20`pip=20i=E2=80=A6?= =?UTF-8?q?=20(#9723)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Description: You cannot execute spark_sql with versions prior to 3.4 due to the introduction of pyspark.errors in version 3.4. And if you are below you get 3.4 "pyspark is not installed. Please install it with pip nstall pyspark" which is not helpful. Also if you not have pyspark installed you get already the error in init. I would return all errors. But if you have a different idea feel free to comment. Issue: None Dependencies: None Maintainer: --------- Co-authored-by: Bagatur --- libs/langchain/langchain/utilities/spark_sql.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/libs/langchain/langchain/utilities/spark_sql.py b/libs/langchain/langchain/utilities/spark_sql.py index ffecbe511d4..20c1e8e5b2f 100644 --- a/libs/langchain/langchain/utilities/spark_sql.py +++ b/libs/langchain/langchain/utilities/spark_sql.py @@ -179,14 +179,8 @@ class SparkSQL: If the statement throws an error, the error message is returned. """ - try: - from pyspark.errors import PySparkException - except ImportError: - raise ValueError( - "pyspark is not installed. Please install it with `pip install pyspark`" - ) try: return self.run(command, fetch) - except PySparkException as e: + except Exception as e: """Format the error message""" return f"Error: {e}"