alexarchambault on developer-documentation-links-readme
alexarchambault on master
Add links to developer document… (compare)
alexarchambault on developer-documentation-links-readme
Add links to developer document… (compare)
alexarchambault on developer-documentation-links-readme
Add links to developer document… (compare)
Hi all, I'm trying to run a custom Scala kernel for 2.13 but encountering some compilation issues. I used to think it's a bug in Ammonite, but I'm not sure anymore. I can even reproduce it with official instructions available at https://almond.sh/docs/quick-start-install.html#create-a-launcher where I set SCALA_VERSION=2.13.0
(it works with 2.12.x). When running the kernel in jupyter I get:
Compiling (synthetic)/ammonite/predef/interpBridge.sc
ERROR AmmInterpreter$ Caught exception while initializing interpreter
almond.amm.AmmInterpreter$PredefException:
almond.amm.AmmInterpreter$.$anonfun$apply$3(AmmInterpreter.scala:130)
almond.amm.AmmInterpreter$.$anonfun$apply$3$adapted(AmmInterpreter.scala:125)
scala.Option$WithFilter.foreach(Option.scala:437)
almond.amm.AmmInterpreter$.apply(AmmInterpreter.scala:125)
almond.ScalaInterpreter.ammInterp$lzycompute(ScalaInterpreter.scala:97)
almond.ScalaInterpreter.ammInterp(ScalaInterpreter.scala:61)
almond.ScalaKernel$$anon$5.run(ScalaKernel.scala:136)
java.lang.NoClassDefFoundError: scala/tools/nsc/reporters/AbstractReporter
ammonite.interp.Compiler$.apply(Compiler.scala:141)
ammonite.interp.CompilerLifecycleManager.init(CompilerLifecycleManager.scala:98)
almond.amm.AmmInterpreter$$anon$1$$anon$2.preprocess(AmmInterpreter.scala:113)
ammonite.interp.Interpreter.compileRunBlock$1(Interpreter.scala:509)
ammonite.interp.Interpreter.$anonfun$processAllScriptBlocks$15(Interpreter.scala:569)
ammonite.util.Res$Success.flatMap(Res.scala:62)
ammonite.interp.Interpreter.$anonfun$processAllScriptBlocks$14(Interpreter.scala:566)
ammonite.util.Res$Success.flatMap(Res.scala:62)
which is weird because scala/tools/nsc/reporters/AbstractReporter
is a 2.12.x compiler class, not 2.13.x.
Any ideas?
Hi again,
I'd like to use ScalaIntepreter, but when I create it, I get
almond.amm.AmmInterpreter$PredefException:
at almond.amm.AmmInterpreter$.$anonfun$apply$3(AmmInterpreter.scala:130)
...
Caused by: scala.reflect.internal.FatalError: Error accessing /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-3.b10.fc26.x86_64/jre/lib/ext/java-atk-wrapper.jar
at scala.tools.nsc.classpath.AggregateClassPath.$anonfun$list$3(AggregateClassPath.scala:99)
...
Can I somehow fixed? Maybe with correct ScalaInterpreterParams?
Thanks.
Hello again,
Playing with Classloaders (both ScalaIntepreter
param and current Thread context one), I've managed to initialize ScalaInterpeter
.
But trying to execute code there fails for me with Compilation Failure
.
For code val x = 1
I get following error:
cmd0.sc:7: exception during macro expansion:
java.lang.IllegalArgumentException: argument type mismatch
.printOnChange(x, "x", _root_.scala.None, _root_.scala.None, _root_.scala.None)) }
Looked at almond code a bit, I've experimented and set ScalaInterpreter
params autoUpdateLazyVals
and autoUpdateVars
both to false, and got slightly different error:
cmd0.sc:8: exception during macro expansion:
java.lang.IllegalArgumentException: argument type mismatch
.print(x, "x", _root_.scala.None)
Maybe someone can give me a clue, how to solve it? Thanks.
scala-compiler
2.13.1 dependency. This is problematic for custom kernels that are still on 2.13.0 because ammonite cross compiles to a full Scala version (not just binary one)../almond --log debug --connection-file scala.kernel.json
DEBUG ScalaKernel$ Auto dependency:
Trigger: Module(org.apache.spark, *)
Adds: Dependency(Module(sh.almond, almond-spark_2.12), 0.9.1)
DEBUG ScalaKernel$ Creating interpreter
DEBUG ScalaKernel$ Created interpreter
DEBUG ScalaKernel$ Running kernel
DEBUG ScalaKernel$ Initializing interpreter (background)
INFO AmmInterpreter$ Creating Ammonite interpreter
DEBUG AmmInterpreter$ Initializing interpreter predef
Compiling (synthetic)/ammonite/predef/interpBridge.sc
DEBUG ZeromqConnection Opening channels for ConnectionParameters(127.0.0.1,tcp,33763,35867,59313,42939,44325,****,Some(hmac-sha256),Some(scala))
ERROR AmmInterpreter$ Caught exception while initializing interpreter
almond.amm.AmmInterpreter$PredefException:
almond.amm.AmmInterpreter$.$anonfun$apply$3(AmmInterpreter.scala:130)
almond.amm.AmmInterpreter$.$anonfun$apply$3$adapted(AmmInterpreter.scala:125)
scala.Option$WithFilter.foreach(Option.scala:407)
almond.amm.AmmInterpreter$.apply(AmmInterpreter.scala:125)
almond.ScalaInterpreter.ammInterp$lzycompute(ScalaInterpreter.scala:97)
almond.ScalaInterpreter.ammInterp(ScalaInterpreter.scala:61)
almond.ScalaKernel$$anon$5.run(ScalaKernel.scala:136)
java.lang.NoSuchMethodError: scala.tools.nsc.classpath.ZipAndJarClassPathFactory$.create(Lscala/reflect/io/AbstractFile;Lscala/tools/nsc/Settings;)Lscala/tools/nsc/util/ClassPath;
ammonite.interp.ExtraCompilerCompatibility.createZipJarFactory(ExtraCompilerCompatibility.scala:10)
ammonite.interp.Compiler$.$anonfun$prepareJarCp$2(Compiler.scala:372)
scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:238)
scala.collection.Iterator.foreach(Iterator.scala:941)
scala.collection.Iterator.foreach$(Iterator.scala:941)
scala.collection.AbstractIterator.foreach(Iterator.scala:1429)
scala.collection.IterableLike.foreach(IterableLike.scala:74)
scala.collection.IterableLike.foreach$(IterableLike.scala:73)
scala.collection.AbstractIterable.foreach(Iterable.scala:56)
scala.collection.TraversableLike.map(TraversableLike.scala:238)
scala.collection.TraversableLike.map$(TraversableLike.scala:231)
scala.collection.AbstractTraversable.map(Traversable.scala:108)
ammonite.interp.Compiler$.prepareJarCp(Compiler.scala:369)
ammonite.interp.Compiler$.initGlobalClasspath(Compiler.scala:400)
ammonite.interp.Compiler$$anon$1.<init>(Compiler.scala:206)
ammonite.interp.Compiler$.apply(Compiler.scala:141)
ammonite.interp.CompilerLifecycleManager.init(CompilerLifecycleManager.scala:98)
almond.amm.AmmInterpreter$$anon$1$$anon$2.preprocess(AmmInterpreter.scala:113)
ammonite.interp.Interpreter.compileRunBlock$1(Interpreter.scala:509)
ammonite.interp.Interpreter.$anonfun$processAllScriptBlocks$15(Interpreter.scala:569)
ammonite.util.Res$Success.flatMap(Res.scala:62)
ammonite.interp.Interpreter.$anonfun$processAllScriptBlocks$14(Interpreter.scala:566)
ammonite.util.Res$Success.flatMap(Res.scala:62)
ammonite.interp.Interpreter.$anonfun$processAllScriptBlocks$12(Interpreter.scala:563)
scala.Option.getOrElse(Option.scala:189)
ammonite.interp.Interpreter.loop$1(Interpreter.scala:563)
ammonite.interp.Interpreter.processAllScriptBlocks(Interpreter.scala:601)
ammonite.interp.Interpreter.$anonfun$processModule$6(Interpreter.scala:397)
ammonite.util.Catching.flatMap(Res.scala:115)
ammonite.interp.Interpreter.$anonfun$processModule$5(Interpreter.scala:388)
ammonite.util.Res$Success.flatMap(Res.scala:62)
ammonite.interp.Interpreter.processModule(Interpreter.scala:378)
ammonite.interp.Interpreter.$anonfun$initializePredef$1(Interpreter.scala:126)
ammonite.interp.Interpreter.$anonfun$initializePredef$1$adapted(Interpreter.scala:126)
ammonite.interp.PredefInitialization$.$anonfun$apply$7(PredefInitialization.scala:75)
ammonite.util.Res$.$anonfun$fold$1(Res.scala:32)
here is rest of the error:
scala.collection.LinearSeqOptimized.foldLeft(LinearSeqOptimized.scala:126)
scala.collection.LinearSeqOptimized.foldLeft$(LinearSeqOptimized.scala:122)
scala.collection.immutable.List.foldLeft(List.scala:89)
ammonite.util.Res$.fold(Res.scala:30)
ammonite.interp.PredefInitialization$.apply(PredefInitialization.scala:63)
ammonite.interp.Interpreter.initializePredef(Interpreter.scala:128)
almond.amm.AmmInterpreter$.apply(AmmInterpreter.scala:125)
almond.ScalaInterpreter.ammInterp$lzycompute(ScalaInterpreter.scala:97)
almond.ScalaInterpreter.ammInterp(ScalaInterpreter.scala:61)
almond.ScalaKernel$$anon$5.run(ScalaKernel.scala:136)
and here are version numbers:
$ scala -version
Scala code runner version 2.12.8 -- Copyright 2002-2018, LAMP/EPFL and Lightbend, Inc.
$ java -version
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (build 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08)
OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode)
$ javac -version
javac 1.8.0_242
scala-reflect
binary incompatibilies. I've also been fighting with that once I resolved scala-compilar
compatibility issues.sbt publish
(on host) -> coursier fetch
(in docker file) would work but I would like to skip pushing the artifact to external repo. Do you know how (or which) to copy artifacts from sbt target
so it will be properly picked up by kernel (so ammonite
and coursier
)
nbconvert
in the docker build which will do a coursier fetch as well. The advantage is that it will stay in sync with your import $ivy ...
statements in the notebook.
Exception in thread "main" java.lang.NoClassDefFoundError: scala/MatchError
at org.apache.spark.deploy.yarn.ExecutorLauncher$.main(ApplicationMaster.scala:833)
at org.apache.spark.deploy.yarn.ExecutorLauncher.main(ApplicationMaster.scala)
Caused by: java.lang.ClassNotFoundException: scala.MatchError
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 2 more