twosigma / beakerx

Beaker Extensions for Jupyter Notebook
http://BeakerX.com
Apache License 2.0
2.8k stars 382 forks source link

Kotlin broken on OSX? #7894

Open bherrmann7 opened 5 years ago

bherrmann7 commented 5 years ago

installed Anaconda via web site

# installing beakerx
$ conda install -c conda-forge ipywidgets beakerx
$ jupyter notebook
choose New Kotlin page... 
[I 19:55:45.520 NotebookApp] Kernel started: 66825790-66fa-4e5f-a82b-7d6e79189b33
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.twosigma.beakerx.kotlin.evaluator.ReplWithClassLoaderFactory (file:/anaconda3/lib/python3.7/site-packages/beakerx/kernel/kotlin/lib/kotlin.jar) to field java.lang.ClassLoader.parent
WARNING: Please consider reporting this to the maintainers of com.twosigma.beakerx.kotlin.evaluator.ReplWithClassLoaderFactory
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 10888 out of bounds for length 10888
    at org.jetbrains.org.objectweb.asm.ClassReader.readUnsignedShort(ClassReader.java:2464)
    at org.jetbrains.org.objectweb.asm.ClassReader.readUTF8(ClassReader.java:2525)
    at org.jetbrains.org.objectweb.asm.ClassReader.readModule(ClassReader.java:761)
    at org.jetbrains.org.objectweb.asm.ClassReader.accept(ClassReader.java:646)
    at org.jetbrains.org.objectweb.asm.ClassReader.accept(ClassReader.java:507)
    at org.jetbrains.kotlin.resolve.jvm.modules.JavaModuleInfo$Companion.read(JavaModuleInfo.kt:67)
    at org.jetbrains.kotlin.cli.jvm.modules.CliJavaModuleFinder.findSystemModule(CliJavaModuleFinder.kt:44)
    at org.jetbrains.kotlin.cli.jvm.modules.CliJavaModuleFinder.access$findSystemModule(CliJavaModuleFinder.kt:25)
    at org.jetbrains.kotlin.cli.jvm.modules.CliJavaModuleFinder$systemModules$1.invoke(CliJavaModuleFinder.kt:37)
    at org.jetbrains.kotlin.cli.jvm.modules.CliJavaModuleFinder$systemModules$1.invoke(CliJavaModuleFinder.kt:25)
    at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:149)
    at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:109)
    at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:133)
    at kotlin.sequences.FlatteningSequence$iterator$1.ensureItemIterator(Sequences.kt:254)
    at kotlin.sequences.FlatteningSequence$iterator$1.hasNext(Sequences.kt:241)
    at kotlin.sequences.SequencesKt___SequencesKt.none(_Sequences.kt:1266)
    at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.addModularRoots(ClasspathRootsResolver.kt:227)
    at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.computeRoots(ClasspathRootsResolver.kt:124)
    at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.convertClasspathRoots(ClasspathRootsResolver.kt:79)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:230)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:114)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createForProduction(KotlinCoreEnvironment.kt:409)
    at org.jetbrains.kotlin.cli.jvm.repl.GenericReplChecker.<init>(GenericReplChecker.kt:63)
    at org.jetbrains.kotlin.cli.jvm.repl.GenericReplCompiler.<init>(GenericReplCompiler.kt:53)
    at org.jetbrains.kotlin.cli.jvm.repl.ReplInterpreter$scriptCompiler$2.invoke(ReplInterpreter.kt:80)
    at org.jetbrains.kotlin.cli.jvm.repl.ReplInterpreter$scriptCompiler$2.invoke(ReplInterpreter.kt:34)
    at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:131)
    at org.jetbrains.kotlin.cli.jvm.repl.ReplInterpreter.getScriptCompiler(ReplInterpreter.kt)
    at org.jetbrains.kotlin.cli.jvm.repl.ReplInterpreter.access$getScriptCompiler$p(ReplInterpreter.kt:34)
    at org.jetbrains.kotlin.cli.jvm.repl.ReplInterpreter$scriptEvaluator$2.invoke(ReplInterpreter.kt:83)
    at org.jetbrains.kotlin.cli.jvm.repl.ReplInterpreter$scriptEvaluator$2.invoke(ReplInterpreter.kt:34)
    at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:131)
    at org.jetbrains.kotlin.cli.jvm.repl.ReplInterpreter.getScriptEvaluator(ReplInterpreter.kt)
    at org.jetbrains.kotlin.cli.jvm.repl.ReplInterpreter.eval(ReplInterpreter.kt:94)
    at com.twosigma.beakerx.kotlin.evaluator.ReplWithClassLoaderFactory.createReplInterpreter(ReplWithClassLoaderFactory.java:84)
    at com.twosigma.beakerx.kotlin.evaluator.ReplWithClassLoaderFactory.createReplWithKotlinParentClassLoader(ReplWithClassLoaderFactory.java:43)
    at com.twosigma.beakerx.kotlin.evaluator.KotlinEvaluator.createRepl(KotlinEvaluator.java:95)
    at com.twosigma.beakerx.kotlin.evaluator.KotlinEvaluator.<init>(KotlinEvaluator.java:79)
    at com.twosigma.beakerx.kotlin.evaluator.KotlinEvaluator.<init>(KotlinEvaluator.java:61)
    at com.twosigma.beakerx.kotlin.kernel.Kotlin.lambda$main$0(Kotlin.java:113)
    at com.twosigma.beakerx.kernel.KernelRunner.run(KernelRunner.java:24)
    at com.twosigma.beakerx.kotlin.kernel.Kotlin.main(Kotlin.java:101)
[I 19:55:48.509 NotebookApp] KernelRestarter: restarting kernel (1/5), new random ports
bherrmann7 commented 5 years ago

Note, Clojure and Groovy start and appear to work fine. Note too,

$ java -version
openjdk version "11.0.1" 2018-10-16 LTS
OpenJDK Runtime Environment Zulu11.2+3 (build 11.0.1+13-LTS)
OpenJDK 64-Bit Server VM Zulu11.2+3 (build 11.0.1+13-LTS, mixed mode)
bherrmann7 commented 5 years ago

What can I do to troubleshoot and/or provide more information?

altavir commented 5 years ago

It seems like kotlin compiler binary compatibility error. Do you have kotlin compiler installed locally?

By the way, Kotlin 1.3.10 now has much better embedded compiler tooling, I think that kotlin plugin should be updated. Maybe switch to JSR223. Sadly, I do not have time to do it right now. Maybe will look into that next month.

altavir commented 5 years ago

I've reproduced the error on Windows. Probably the Java 11 compatibility.

bherrmann7 commented 5 years ago

Yes, I do have kotlin installed locally,

$ kotlinc
Welcome to Kotlin version 1.3.10 (JRE 11.0.1+13-LTS)
Type :help for help, :quit for quit
>>>
bherrmann7 commented 5 years ago

Huh. I tried switching to jdk1.8... but jupyter seems to find JDK11 anyway...

$ export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home
$ export PATH=$JAVA_HOME:$PATH
$ java -version
java version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)
$ jupyter notebook
... same error

Oh, I think this is because anaconda now ships jdk 11 $ ls /anaconda3/conda-meta/jdk conda-meta/openjdk-11.0.1-h470a237_14.json

altavir commented 5 years ago

I confirm, it is a java 11 problem. Everything works fine with java 8. Beakerx uses obsolete Kotlin compiler and not-really-supported embedding mode. It requires some work. There was a discussion about it few months ago. Also #7759 is somehow similar.

altavir commented 5 years ago

Just to make this constructive, now KEEP-75 should be fully or mostly functional, so we should use it.