Bug when installing latest Scala with Coursier

Hey! While doing a new installation of scala on fedora with coursier, it seems to have installed Scala 3.5.0 with scala-cli 1.4.3, and therefore it throws the warning:

[warning] MainGenericRunner class is deprecated since Scala 3.5.0, and Scala CLI features will not work.
[warning] Please be sure to update to the Scala CLI launcher to use the new features.
[warning] It appears that your Coursier-based Scala installation is misconfigured.
[warning] To update to the new Scala CLI runner, please update (coursier, cs) commands first before re-installing scala.
[warning] Check the Scala 3.5.0 release notes to troubleshoot your installation.
Scala code runner version 3.5.0 -- Copyright 2002-2024, LAMP/EPFL

here are the steps to reproduce:

System: Thinkpad E14 Gen 4, Intel i7-1255U.
OS: Fedora KDE 40, Kernel: 6.10.5-200
Konsole(KDE terminal), fish instead of bash.

1. sudo dnf install java-21-openjdk java-21-openjdk-devel java-21-openjdk-src
2. curl -fL https://github.com/coursier/coursier/releases/latest/download/cs-x86_64-pc-linux.gz | gzip -d > cs && chmod +x cs && ./cs setup
3. scala --version

I have the same issue on windows, and wsl.

Thanks for reporting this. @Annie-Wb @lego-eden

Perhaps it is due to the pending release process of 3.5.0. As I understand it you cannot use the new scala runner with scala for instance scala repl -S 3.5.0 or scala run . ? @Annie-Wb

Are there more of you out there that have this issue?

A possible workaround for now could be to use scala-cli and give the version explicitly. Does this work for you?

scala-cli repl -S 3.5.0

until the new scala runner is working and the Scala 3.5.0 release process is completed…

I can test this in about 6 hours.

1 Like

This is expected to happen if you are using an old Coursier version.
This is because earlier versions did not support installing native packages, so it defaults to the old runner JAR.

Blockquote
[warning] To update to the new Scala CLI runner, please update (coursier, cs) commands first before re-installing scala.

Do note that this is also explained in the actual warning you are getting.

Should not happen on Coursier 2.1.10 or above.

Aha - many thanks for explanation. How to install a newer cs ? I assume @lego-eden and @Annie-Wb installet it from the current scala-lang and cs update does not seem to help (but that maybe changes now that home page has changed?).

Anyway it’s out now: Scala 3.5.0 released! | The Scala Programming Language
:tada:
This will be amazing! Thanks all!

How to install a newer cs ?

@bjornregnell I think this will depend on the platform you installed it on.

if you followed the instructions from here as they are right now, then:

  • on MacOS you’d have installed it with brew, so brew upgrade should take care of it
  • on Linux you’d have used the Coursier installation script, so I actually believe cs update coursier should work there, as per install · Coursier
  • I am not familliar with running Coursier on Windows, but I’m suspecting reinstalling it manually may be the only way.
1 Like

I am not familliar with running Coursier on Windows, but I’m suspecting reinstalling it manually may be the only way.

No I think its is fine on the official page Install | The Scala Programming Language now, which under the Window-tab points to this windows installer https://github.com/coursier/coursier/releases/latest/download/cs-x86_64-pc-win32.zip that should work as usual by now.

@Annie-Wb @lego-eden I think it is wise to do

cs uninstall --all

before you do the whole thing all over from the official page including an important-not-to-forget reboot to be sure path stuff gets activated. Your troubles were probably due to that you installed in the middle of the release process with some transient inconsistencies… (Also note that if you are using other package managers such as brew or sdkman they may interfere with cs and you may have to uninstall scala-related stuff in your other package manager in order to allow cs to pick up your scala if that is what you want – or you can just keep on using brew or sdkam as scala 3.5.0 is just now also available from there :tada: )

Please report back here @Annie-Wb @lego-eden if you get it all to work for you on your specific platform after uninstalling and reinstalling and reboot. Thanks again for reporting!

I’m using the latest Coursier annie@annie-thinkpad ~> cs version 2.1.10

So, after Scala 3.5.0 has been released, I tried to uninstall everything with cs uninstall --all, then reinstalled using the curl string in Install | The Scala Programming Language, ran cs update then both scala --version and scala-cli --version and the results are the same, as follows

annie@annie-thinkpad ~> cs update
https://repo1.maven.org/maven2/com/lihaoyi/ammonite_3.4.2/maven-metadata.xml
  No new update since 2024-07-18 00:10:48
https://repo1.maven.org/maven2/com/google/code/gson/gson/maven-metadata.xml
  No new update since 2024-05-19 21:00:04
https://repo1.maven.org/maven2/io/get-coursier/coursier-cli_2.13/maven-metadata.xml
  No new update since 2024-05-06 15:20:32
https://repo1.maven.org/maven2/io/get-coursier/coursier-cli_2.13/maven-metadata.xml
  No new update since 2024-05-06 15:20:32
https://repo1.maven.org/maven2/org/scala-lang/scala3-compiler_3/maven-metadata.xml
  No new update since 2024-08-22 06:38:57
https://repo1.maven.org/maven2/org/scala-lang/scala3-compiler_3/maven-metadata.xml
  No new update since 2024-08-22 06:38:57
https://repo1.maven.org/maven2/org/scalameta/scalafmt-cli_2.13/maven-metadata.xml
  No new update since 2024-07-25 13:17:59
annie@annie-thinkpad ~> scala --version
[warning] MainGenericRunner class is deprecated since Scala 3.5.0, and Scala CLI features will not work.
[warning] Please be sure to update to the Scala CLI launcher to use the new features.
[warning] It appears that your Coursier-based Scala installation is misconfigured.
[warning] To update to the new Scala CLI runner, please update (coursier, cs) commands first before re-installing scala.
[warning] Check the Scala 3.5.0 release notes to troubleshoot your installation.
Scala code runner version 3.5.0 -- Copyright 2002-2024, LAMP/EPFL
annie@annie-thinkpad ~> scala-cli --version
Scala CLI version: 1.4.3
Scala version (default): 3.4.2
1 Like

Thanks! So the problem remains or re-appeared, unfortunately. I will do some more testing and also discuss at Contributors and get back here as soon as I got some clue of what is going on.

Anybody else get it to work without warning or not?

I installed Coursier with the installation guide on their website, then installed scala and scala-cli. I got the same warnings as @Annie-Wb when checking scala --version.
However, scala-cli still seems to work and could do scala-cli run . on a project in scala 3.5.

So the workaround found is to also type

cs install scala:3.5.0

after a clean install and then scala should just work without a warning.

(This should hopefully be unnecessary when a new release of cs is available…)

Does that work for you?

3 Likes

Yep that worked for me, thanks!

I just did (with cs 2.1.10)

cs uninstall scala
cs install scala:3.5.0
2 Likes