IScala icon indicating copy to clipboard operation
IScala copied to clipboard

not working under Ipython 3.1 (two issues: installing scala kernel, json communication issue)

Open rustandruin opened this issue 10 years ago • 4 comments

The first problem I ran into is that the procedure for installing alternative ipython kernels has changed since the README was written. I found the following procedure to work:

Create ~/.ipython/kernels/iscala/kernel.json and put it in:

{
  "argv": ["java", "-jar", "<whatever path>/lib/Iscala.jar", "--profile", "{connection_file}"],
  "display_name": "IScala",
  "language": "scala"
}

Run ipython with ipython console --kernel iscala or ipython notebook and then select IScala from the "New" dropdown box to create a new Scala Ipython notebook.

These two steps allow Ipython to connect to the IScala kernel, but there's some issue with the JSON communications between the IScala kernel and IPython that occurs in both the console and notebook interfaces. Here's the error for an attempt to run the console

ipython console --kernel iscala                                                                                                                 [ruby-2.0.0p481]
Welcome to Scala 2.10.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45)
IPython Console 3.1.0

In [1]: val r  = 0
JSON deserialization error: JsResultException(errors:List((/user_variables,List(ValidationError(validate.error.missing-path,WrappedArray())))))

Unfortunately I want to use IScala precisely to learn Scala, so I've no idea how to go about tracking down the problem, much less fixing it. Any help would be greatly appreciated. I've tried several other REPL+ interfaces to Scala, and this is the most natural so far, even if it seems quasi-dead.

BTW: if it turns out as I fear that this project is no longer being supported, scala-notebook worked out of the box for me, albeit has a clunky interface, and there's the Apache incubator Zeppelin project which looks very sweet (has visualization, built in spark support,...) but I have not tried. So there are some other options while we wait to see if IScala's still viable.

rustandruin avatar May 10 '15 00:05 rustandruin

IPython 3.0 changed the way kernels are started but, more importantly, made incompatible changes to the message protocol. So, this breakage is expected, given that the IScala kernel hasn't been updated. The changes needed are probably not too complex, but may be too much for a Scala beginner.

The proliferation of notebook projects that can or could support Scala is unfortunate. I'm with you on scala-notebook feeling clunky, and the multi-language direction of IPython/Jupyter is appealing. Zeppelin looks like a nice data-oriented tool, but I'm not sure if it requires Spark or can operate without it—I use notebooks for general programming, not just data analysis.

jpallas avatar May 12 '15 17:05 jpallas

Zeppelin looks like the best option so far in terms of long-term viability. The interface is clean, and will likely only get better --- it's as nice as Ipython notebooks right now. I've been using it as a REPL, and so far the issues I've had with it stem from the (easy to fix?) fact that it doesn't use :paste for each input cell, so e.g. you can't define a class and a companion object. Whatever Scala and Spark it needs are installed (I have not used Spark). I will probably continue using Zeppelin until a proper Jupyter kernel for Scala comes out.

rustandruin avatar May 12 '15 21:05 rustandruin

To answer your question: yes Zeppelin need to run on Spark interpreter, of which local mode has no difference with Scala REPL except taking a few ports. My only problem with Zeppelin so far is that their interpreter adapter is written in java, hence used too many hacks to call spark API which scared me out immediately.

tribbloid avatar May 16 '15 21:05 tribbloid

You can also use spark-kernel which is very easy to install, and runs pretty well. :+1:

Bonsanto avatar Oct 06 '15 11:10 Bonsanto