<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Error when calling SparkR from within a Python notebook in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/error-when-calling-sparkr-from-within-a-python-notebook/m-p/6755#M2777</link>
    <description>&lt;P&gt;The answer I can give you to have this work for you is to call the R notebooks from your Python notebook. Just save each dataframe as a delta table to pass between the languages.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to call a notebook from another notebook? &lt;A href="https://docs.databricks.com/notebooks/notebook-workflows.html" alt="https://docs.databricks.com/notebooks/notebook-workflows.html" target="_blank"&gt;here is a link&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 17 Apr 2023 17:52:48 GMT</pubDate>
    <dc:creator>Dooley</dc:creator>
    <dc:date>2023-04-17T17:52:48Z</dc:date>
    <item>
      <title>Error when calling SparkR from within a Python notebook</title>
      <link>https://community.databricks.com/t5/data-engineering/error-when-calling-sparkr-from-within-a-python-notebook/m-p/6752#M2774</link>
      <description>&lt;P&gt;I’ve had success with R magic (R cells in a Python notebook) and running an R script from a Python notebook, up to the point of connecting R to a Spark cluster. In either case, I can’t get a `SparkSession` to initialize.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2-cell (Python) notebook example:  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;load_ext rpy2.ipython&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;%%R 
library(SparkR)
sparkR.session()&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Error message from cell 2: &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;R[write to console]: Spark package found in SPARK_HOME: /databricks/spark
&amp;nbsp;
Launching java with spark-submit command /databricks/spark/bin/spark-submit   sparkr-shell /tmp/RtmpPjujEO/backend_port19cf5178fd7d 
R[write to console]: Error in sparkR.sparkContext(master, appName, sparkHome, sparkConfigMap,  : 
  JVM is not ready after 10 seconds
&amp;nbsp;
R[write to console]: In addition: 
R[write to console]: There were 50 or more warnings (use warnings() to see the first 50)
R[write to console]: 
&amp;nbsp;
&amp;nbsp;
Error in sparkR.sparkContext(master, appName, sparkHome, sparkConfigMap,  : 
  JVM is not ready after 10 seconds
RInterpreterError: Failed to parse and evaluate line 'sparkR.session()'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For my collaboration use case, it would be more efficient to drop into a Python notebook and perform analysis in native R, but is it possible to utilize SparkR from within a Python notebook in Databricks?  &lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2023 17:25:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-when-calling-sparkr-from-within-a-python-notebook/m-p/6752#M2774</guid>
      <dc:creator>rshark</dc:creator>
      <dc:date>2023-03-30T17:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: Error when calling SparkR from within a Python notebook</title>
      <link>https://community.databricks.com/t5/data-engineering/error-when-calling-sparkr-from-within-a-python-notebook/m-p/6753#M2775</link>
      <description>&lt;P&gt;Yes, you can use &lt;A href="https://docs.databricks.com/libraries/notebooks-r-libraries.html" alt="https://docs.databricks.com/libraries/notebooks-r-libraries.html" target="_blank"&gt;SparkR in the Databricks notebooks&lt;/A&gt; so you can keep your native R code. You can select at the top part of the notebook in the Databricks GUI that the language will be in R so you are not needing to add %%R to every cell. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="SparkR"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/461i503B39158868BA21/image-size/large?v=v2&amp;amp;px=999" role="button" title="SparkR" alt="SparkR" /&gt;&lt;/span&gt;You can also &lt;A href="https://docs.databricks.com/notebooks/notebook-export-import.html" alt="https://docs.databricks.com/notebooks/notebook-export-import.html" target="_blank"&gt;import the ipython notebook you are using &lt;/A&gt;to Databricks that will convert it to a Databricks notebook. Then set the language to R at the top and you are good to run.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For collaboration, would it be possible that the person gets Databricks restricted access to work on the notebooks with you in the Databricks GUI? Our notebooks allow multiple people to make edits at the same time &amp;amp; you can share notebooks with one another. You can also leave comments for one another to help improve your collaboration.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2023 23:31:46 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-when-calling-sparkr-from-within-a-python-notebook/m-p/6753#M2775</guid>
      <dc:creator>Dooley</dc:creator>
      <dc:date>2023-03-30T23:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: Error when calling SparkR from within a Python notebook</title>
      <link>https://community.databricks.com/t5/data-engineering/error-when-calling-sparkr-from-within-a-python-notebook/m-p/6754#M2776</link>
      <description>&lt;P&gt;I'm actually interested in explicitly running a notebook in Python, but running R code from within it. I have no problem connecting R to a Spark cluster when the language is set to R. Is there a way to connect R to Spark for the Python notebook use case or is this an edge case that Databricks doesn't support?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 16:25:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-when-calling-sparkr-from-within-a-python-notebook/m-p/6754#M2776</guid>
      <dc:creator>rshark</dc:creator>
      <dc:date>2023-04-03T16:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: Error when calling SparkR from within a Python notebook</title>
      <link>https://community.databricks.com/t5/data-engineering/error-when-calling-sparkr-from-within-a-python-notebook/m-p/6755#M2777</link>
      <description>&lt;P&gt;The answer I can give you to have this work for you is to call the R notebooks from your Python notebook. Just save each dataframe as a delta table to pass between the languages.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to call a notebook from another notebook? &lt;A href="https://docs.databricks.com/notebooks/notebook-workflows.html" alt="https://docs.databricks.com/notebooks/notebook-workflows.html" target="_blank"&gt;here is a link&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2023 17:52:48 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-when-calling-sparkr-from-within-a-python-notebook/m-p/6755#M2777</guid>
      <dc:creator>Dooley</dc:creator>
      <dc:date>2023-04-17T17:52:48Z</dc:date>
    </item>
  </channel>
</rss>

