Widgets not working/showing up (could not find implict value/view)

255 views
Skip to first unread message

florian...@gmail.com

unread,
Dec 9, 2015, 5:15:41 AM12/9/15
to spark-notebook-user
Hi all,

First, thanks and congratulations for this cool software product, very impressive! As usual, I have my immediate noob question/beginners problem...

I am using this default distro from spark-notebook.io:

spark-notebook-0.6.1-scala-2.10.4-spark-1.5.0-hadoop-2.6.0-with-hive-with-parquet.zip

I am viewing the notebooks in Google Chrome 47, and am running on OSX 10.10.5.

The problem I have is that I cannot get any widgets to properly show up. The simplest example of my problem is just by trying to run the Spark Configurator example notebook:

import notebook.front.widgets.Spark
new Spark(sparkContext)
<console>:50: error: No implicit view available from org.apache.spark.SparkContext => Unit.
              new Spark(sparkContext)
              ^

So somehow some kind of implict conversions are not getting loaded? Funny, given this is an example notebook...

Also, if I create DataFrames in my notebooks, the paged view that shows up has the page indicator and the column headers of the DF, but no rows. (Naturally, the DF has context and using the default approach via sqlContext.sql("SELECT ...").show() produces results, so this is purely a display/widget problem. Am I missing anyting? Any pointers as to where I should go looking?

Finally, if I evaluate an SQL context with %sql and then try to push that output into a widget, I get a similar error about implicits:

<console>:92: error: could not find implicit value for evidence parameter of type notebook.front.widgets.magic.Implicits.ToPoints[notebook.front.widgets.Sql]

Is there anybody out there who understands what my problem is? Thanks in advance!

Regards,
Florian

florian...@gmail.com

unread,
Dec 9, 2015, 6:38:13 AM12/9/15
to spark-notebook-user
More examples of the issue I found on the provided notebooks "Using DataTable" and "Using DataTable (with implicits)". Seems to have to do with the Play JSON library (?):


Create the codec for the data

In [6]:
import notebook.Codec
import notebook.JsonCodec._
implicit val dataCodec:Codec[JsValue, Data] = formatToCodec(f)
<console>:64: error: type mismatch;
 found   : play.api.libs.json.Format[Data]
 required: Option[String => Data]
       implicit val dataCodec:Codec[JsValue, Data] = formatToCodec(f)
                                                                   ^

Show the data in a table

In [7]:
import notebook.front.widgets._  
new DataTable(data)(dataCodec).plot
<console>:62: error: not found: value dataCodec
              new DataTable(data)(dataCodec).plot


And from the "with implicits" notebook:

To use implicit conversions and so on for a type defined within the notebook, you'll have to define all stuffs (related to these deinitions) into a single box → there are some problems with the compiler to resolve the right types in REPL mode.

In [1]:
case class Person(first:String, last:String, age:Int, isFemale:Boolean)
import play.api.libs.json._
import play.api.libs.functional.syntax._
implicit val format = Json.format[Person]
  
import notebook.Codec
import notebook.JsonCodec._
implicit val dataCodec:Codec[JsValue, Person] = formatToCodec(format)
  
import scala.util.Random._
def random = Person(List.fill(10)(nextPrintableChar).mkString(""), List.fill(10)(nextPrintableChar).mkString(""), nextInt(200), nextBoolean)
val data = List.fill(100)(random)
import notebook.front.widgets._  
new DataTable(data)(dataCodec).plot
<console>:17: error: type mismatch;
 found   : play.api.libs.json.OFormat[Person]
 required: Option[String => Person]
              implicit val dataCodec:Codec[JsValue, Person] = formatToCodec(format)
                                                                            ^

I'm still clueless as to the origin of this problem, so help would certainly be appreciated!

Regards,
Florian

florian...@gmail.com

unread,
Dec 9, 2015, 6:40:01 AM12/9/15
to spark-notebook-user
Sorry, that last one is rather garbled; the (only) error response I get on the "with implicits" example notebook is:



<console>:17: error: type mismatch;
 found   : play.api.libs.json.OFormat[Person]
 required: Option[String => Person]
              implicit val dataCodec:Codec[JsValue, Person] = formatToCodec(format)
                                                                            ^


andy petrella

unread,
Dec 9, 2015, 6:52:37 AM12/9/15
to florian...@gmail.com, spark-notebook-user
Hello Florian, 

Actually DataTable is rather oldish because the current support for table has been extended, and thus tables are printed out directly when you simply return a sequence at the end of the cell.

Indeed, if you need more fancy table, I guess we plan that in either the default rendering or in DataTable...
Or you create a DataFrame out of it, and it's going to be rendered in a Dyna Table.

HTH

PS: BTW, thanks for the kind words :-D, glad you like it


--
You received this message because you are subscribed to the Google Groups "spark-notebook-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spark-notebook-...@googlegroups.com.
To post to this group, send email to spark-not...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/spark-notebook-user/bbddd52e-1f16-4834-8b16-74ff5b3cfb0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
andy

florian...@gmail.com

unread,
Dec 9, 2015, 9:23:47 AM12/9/15
to spark-notebook-user
Hi Andy,

Thank you for taking the time to answer me! The viz examples have me totally startled, that is much deeper than what you show on the GitHub page. I nearly chose a competitor notebook over spark-notebook because I thought there are not very many visualization tools in here.

Thanks for clarifying the DataTable cases.

Re. my other issues, I cannot tell you why or how, but just now, after the most resent restarting of the notebook server, the content (DataFrames, charts, etc.) suddenly is being displayed properly. Oh my - once again showing my main beef with Scala - its "implicitly non-deterministic" behavior (if only the implicits were not also be the reason why Scala is so powerful...)

Whatever, in any case, thanks for a wonderful product, looking forward to doing all the Bokeh and D3 wonders from a Scala notebook!

Florian
To unsubscribe from this group and stop receiving emails from it, send an email to spark-notebook-user+unsub...@googlegroups.com.
--
andy
Reply all
Reply to author
Forward
0 new messages