scala-notebook icon indicating copy to clipboard operation
scala-notebook copied to clipboard

How to import a class from a jar?

Open tribbloid opened this issue 10 years ago • 10 comments

I'm trying to combine it with Apache Spark (one of the hottest framework for data analysis) but I don't know how to do it. Can someone give me a hint so I can possibly implement it myself? Of course, if someone is still maintaining this project.

tribbloid avatar Jun 27 '14 07:06 tribbloid

I think you only need to add it to the kernel dependencies https://github.com/Bridgewater/scala-notebook/blob/98eecbcf03a87c44df64b589bb455289235e9c71/project/build.scala#L101

MasseGuillaume avatar Jun 27 '14 13:06 MasseGuillaume

Tribbloid, I'm trying to get it working with spark as well. Adding it to the kernel allows you to import it, but I'm still running into issues because scala notebook uses akka 2.1.4, while spark 1.0 uses akka 2.2.3. If you get it working, I'd love to hear about it, and I'll do the same.

tylerprete avatar Jun 30 '14 01:06 tylerprete

Hi Tyler,

Thanks a lot! I'm not a proficient sbt user but I've encounter another jar hell problem in maven: http://apache-spark-user-list.1001560.n3.nabble.com/Spark-throws-NoSuchFieldError-when-testing-on-cluster-mode-td8064.html#a8083

The solution in maven is to include maven-shade plugin and rename the akka package in the notebook (since spark-shell will always load himself first). I'll fork this repo and migrate to maven in a few days.

I'm not sure if sbt-assembly has a similar switch that can do this. Perhaps it worths a try :)

Yours Peng

tribbloid avatar Jun 30 '14 05:06 tribbloid

I tried upgrading to akka 2.2 but had trouble with the remote forking. Maybe I'll try it again.

Ken

On Jun 29, 2014, at 9:10 PM, Tyler Prete [email protected] wrote:

Tribbloid, I'm trying to get it working with spark as well. Adding it to the kernel allows you to input it, but I'm still running it issues because scala notebook uses akka 2.1.4, while spark 1.0 uses akka 2.2.3. If you get it working, I'd love to hear about it, and I'll do the same.

— Reply to this email directly or view it on GitHub.

KenCoder avatar Jun 30 '14 13:06 KenCoder

Hi all, I'm going to give this a try. However, I would prefer to catch up where you guyz are. Is there any sample repo from where I can go ahead? Thanks in advance

andypetrella avatar Aug 18 '14 08:08 andypetrella

So I started an integration... the hard way, but works quite fine: https://github.com/andypetrella/scala-notebook/tree/spark

andypetrella avatar Sep 18 '14 18:09 andypetrella

Any doc to get it working with Spark?

akhld avatar Sep 19 '14 11:09 akhld

I'll try to put some doc in the README, and most probably a blog, however the changes are quite deep and will be hard (non trivial) to migrate back :-(

andypetrella avatar Sep 19 '14 12:09 andypetrella

I gave this one a try https://github.com/andypetrella/scala-notebook/tree/spark but it couldn't compile the code. See the image below image

akhld avatar Sep 20 '14 08:09 akhld

To not pollute this entry, could you fill an issue on the repo? Although this is not a compilation error but a (AFAICS) a misusage of sbt. There are several manner to use it, the longer but safer:

sbt project server run

The fastest:

sbt server/run

andypetrella avatar Sep 20 '14 08:09 andypetrella