almond-sh / almond

A Scala kernel for Jupyter
https://almond.sh
BSD 3-Clause "New" or "Revised" License
1.59k stars 239 forks source link

Could not find or load main class coursier.bootstrap.launcher.Launcher #1233

Open swissarthurfreeman opened 1 year ago

swissarthurfreeman commented 1 year ago

Hello,

I'm trying to setup a test jupyterhub with nbgrader instance that uses a scala kernel. I've been following the instructions and I can't seem to get it to work. I'm installing almond with the --global option as if it's ommited jupyter kernelspec list does not find the scala kernel. The installation steps I followed (after downloading the courier file using curl as per the instructions)

jupyter kernelspec list
Available kernels:
  python3    /usr/local/share/jupyter/kernels/python3
gordon@jupyter-playground:~$ sudo ./coursier launch --fork almond -- --install --global
[sudo] password for gordon: 
Installed scala kernel under /usr/local/share/jupyter/kernels/scala
gordon@jupyter-playground:~$ jupyter kernelspec list
Available kernels:
  python3    /usr/local/share/jupyter/kernels/python3
  scala      /usr/local/share/jupyter/kernels/scala

Upon launching a jupyter notebook instance, I do indeed see the scala kernel image But after a couple of seconds, I it gets disconnected, the Scala icon disappears and the text goes to 'No Kernel'

Jupyter notebook console I get the error :

[I 2023-08-11 13:00:14.872 ServerApp] 200 GET /user/instructor1/api/sessions?1691751614855 (instructor1@::ffff:127.0.0.1) 2.65ms
[I 2023-08-11 13:00:14.888 ServerApp] 200 GET /user/instructor1/api/kernelspecs?1691751614877 (instructor1@::ffff:127.0.0.1) 3.40ms
Error: Could not find or load main class coursier.bootstrap.launcher.Launcher
Caused by: java.lang.ClassNotFoundException: coursier.bootstrap.launcher.Launcher

Followed by multiple retries until a "Kernel Does not Exist" error is thrown. I've tried with almond kernel 0.10.0 but had a similar error, instead it was a 'Class almond.ScalaKernel not found' error.

My java version output is :

java -version
openjdk version "11.0.20" 2023-07-18
OpenJDK Runtime Environment (build 11.0.20+8-post-Ubuntu-1ubuntu122.04)
OpenJDK 64-Bit Server VM (build 11.0.20+8-post-Ubuntu-1ubuntu122.04, mixed mode, sharing)

I'm at a loss as to what to do here, any help or ideas would be appreciated.

octavd commented 1 year ago

Hello,

I am having the same issue here.

LE: @swissarthurfreeman, for me it worked with the following versions of almond 0.13.3 and scala 2.13.10

./coursier launch --fork almond:0.13.3 --scala 2.13.10 -- --install --global
openjdk 17.0.4 2022-07-19
OpenJDK Runtime Environment (build 17.0.4+8-Ubuntu-122.04)
OpenJDK 64-Bit Server VM (build 17.0.4+8-Ubuntu-122.04, mixed mode, sharing)
coreyoconnor commented 4 months ago

This is mentioned somewhere but the short version is: Gotta make sure the notebook can actually find the coursier cache.

I used

ENV COURSIER_CACHE=/usr/share/coursier/cache

in a dockerfile to set this.

See related issue: https://github.com/almond-sh/almond/issues/729