jupyter-scala with Spark does not see imports
See original GitHub issueI am running jupyter notebook on the machine where is available configured spark distribution with spark-submit , spark-defaults etc. I have running Python and R kernels but I have issues with jupyter-scala. I try to run the following code inside the notebook;
import org.apache.spark.SparkConf
import org.apache.spark.SparkContext
import org.apache.spark.SparkContext._
import com.datastax.spark.connector._
val conf = new SparkConf(true)
val sc = new SparkContext("spark://127.0.0.1:7077", "test", conf)
but it seems the jars are not visible by it
Main.scala:29: object datastax is not a member of package com
; import org.apache.spark.SparkConf ; import org.apache.spark.SparkContext ; import com.datastax.spark.connector._ ; val conf = { () =>
^
Main.scala:29: object apache is not a member of package org
; import org.apache.spark.SparkConf ; import org.apache.spark.SparkContext ; import com.datastax.spark.connector._ ; val conf = { () =>
^
Main.scala:30: not found: type SparkConf
new SparkConf(true)
^
Main.scala:29: object apache is not a member of package org
; import org.apache.spark.SparkConf ; import org.apache.spark.SparkContext ; import com.datastax.spark.connector._ ; val conf = { () =>
^
Main.scala:33: not found: type SparkContext
new SparkContext("spark://127.0.0.1:7077", "test", conf)
^
I have tried to add before it
classpath.addPath("/var/lib/spark/lib/spark-assembly-1.6.0-hadoop2.6.0.jar")
classpath.add("datastax" % "spark-cassandra-connector" % "1.6.0-M1-s_2.11")
but nothing changes.
I am running jupyter-scala from https://git.io/vzhRi .
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
apache spark - Import custom scala object in jupyter notebook ...
1 Answer 1 · --jars option on spark commandline · spark.sparkContext.addJar(/path/to/JAR/file).
Read more >How To Use Jupyter Notebooks with Apache Spark
In this post, we will see how to incorporate Jupyter Notebooks with ... Scala is the ideal language to interact with Apache Spark...
Read more >Databricks Connect - Azure - Microsoft Learn
With Databricks Connect, you can: Run large-scale Spark jobs from any Python, Java, Scala, or R application. Anywhere you can import pyspark , ......
Read more >PixieDust 3 - Scala and Python - | notebook.community
Unfortunately, Jupyter Python notebooks do not currently provide a way to call out Scala or Java code. As a result, a typical workaround...
Read more >almond-sh/almond - Gitter
Noting that ammonite-spark did not like the latest Ammonite version, ... See https://almond.sh/docs/api-jupyter.html#updatable-display-data. plotly-scala ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is how I went about solving the issue I had (similar to you) Installed Jupyter Toree from here: https://github.com/apache/incubator-toree
I run into the same issue with Spark 2.3 and Scala 2.11. I used this repo to integrate with jupyter but seeing same error. Is there Toree agnostic way to integrate Spark+Scala and Jupyter? Also spark assembly is no longer presented in spark distribution. Perhaps your README and This notebook has to be updated