jow*_*l93 11 py4j pyspark apache-spark-ml
您好,我正在与 Pyspark 合作,第一次使用 ML 包实施情感分析项目,cofde 工作正常,但突然显示上面提到的错误有人可以帮忙吗这是完整的错误描述
ERROR:py4j.java_gateway:An error occurred while trying to connect to the Java server (127.0.0.1:50532)
Traceback (most recent call last):
File "C:\opt\spark\spark-2.3.0-bin-hadoop2.7\python\lib\py4j-0.10.6-src.zip\py4j\java_gateway.py", line 852, in _get_connection
connection = self.deque.pop()
IndexError: pop from an empty deque
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\opt\spark\spark-2.3.0-bin-hadoop2.7\python\lib\py4j-0.10.6-src.zip\py4j\java_gateway.py", line 990, in start
self.socket.connect((self.address, self.port))
ConnectionRefusedError: [WinError 10061] Aucune connexion n’a pu être établie car l’ordinateur cible l’a expressément refusée
Run Code Online (Sandbox Code Playgroud)
And*_*101 11
如果您使用的是 Jupyter nootbook,只需重新启动您的笔记本。如果没有,那么只需重新启动 pyspark 。这应该可以解决问题。发生这种情况是因为您使用了太多收集或其他一些与内存相关的问题。
向 Spark 添加更多资源。例如,如果您正在本地模式下工作,如下所示的配置就足够了:
spark = SparkSession.builder \
.appName('app_name') \
.master('local[*]') \
.config('spark.sql.execution.arrow.pyspark.enabled', True) \
.config('spark.sql.session.timeZone', 'UTC') \
.config('spark.driver.memory','32G') \
.config('spark.ui.showConsoleProgress', True) \
.config('spark.sql.repl.eagerEval.enabled', True) \
.getOrCreate()
Run Code Online (Sandbox Code Playgroud)