question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Py4JJavaError: An error occurred while calling z:org.apache.spark.api.python.PythonRDD.collectAndServe.

See original GitHub issue

Hi, I’m trying to use elephas for my deep learning models on spark but so far I couldn’t even get anything to work on 3 different machines and on multiple notebooks.

  • “ml_pipeline_otto.py” crashes on the load_data_frame function, more specifically on return sqlContext.createDataFrame(data, ['features', 'category']) with the error : Py4JJavaError: An error occurred while calling z:org.apache.spark.api.python.PythonRDD.runJob.

  • “mnist_mlp_spark.py” crashes on the spark_model.fit method with the error : TypeError: can't pickle _thread.RLock objects

  • “My Own Pipeline” crashes right after fitting (it actually trains it) the model with this error : Py4JJavaError: An error occurred while calling z:org.apache.spark.api.python.PythonRDD.collectAndServe.

I’m running tensorflow 2.1.0, pyspark 3.0.2, jdk-8u281 and python 3.7 and elephas 1.4.2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13

github_iconTop GitHub Comments

4reactions
nboyarkincommented, Jun 21, 2022

Hi there! Had the same issue, but this solution helped: import findspark findspark.init() Initialize it before the creation of spark session

3reactions
GaneshJalakamcommented, Aug 15, 2022

Hi,

Thanks had same issue its been resolved. import findspark findspark.init() Initialize it before the creation of spark session

Note: Windows seems has other dependencies, Not sure what was the issue but its fixed now. please pass it on detail like how this package help to resolve this.

Hi Mayank,

Thanks for your comments. ‘findspark’ package helped me to solve the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

py4j.protocol.Py4JJavaError occurred while calling z:org ...
I had a java 10 installed and tried to run the Python examples from: http://spark.apache.org/docs/2.3.1/, i.e. things as simple as:
Read more >
Error using pyspark .rdd.map (different Python version)
Hi,. Spark is complaining that the cluster nodes are using python2.7 while your DSS node is using python3.6. You need to create a...
Read more >
Apache-spark – py4j.protocol.Py4JJavaError occurred while calling ...
Py4JJavaError occurred while calling z:org.apache.spark.api.python.PythonRDD.collectAndServe. apache-sparkpy4jpycharmpysparkpython-3.x.
Read more >
HelloSpark Tutorial Error: An error occurred while calling z:org ...
Py4JJavaError : An error occurred while calling z:org.apache.spark.api.python.PythonRDD.collectAndServe. : java.lang.IllegalArgumentException at ...
Read more >
PySpark input path errors - Google Groups
py4j.protocol.Py4JJavaError: An error occurred while calling z:org.apache.spark.api.python.PythonRDD.collectAndServe.: org.apache.hadoop.mapred.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found