Coursier install never reliable

I use Scala for teaching students. Today, for a third student, we attempted to install the scala suite of tools using Coursier. We opened PowerShell as administrator and pasted the steps detailed here Installation · Coursier

Invoke-WebRequest -Uri "https://github.com/coursier/launchers/raw/master/cs-x86_64-pc-win32.zip" -OutFile "cs-x86_64-pc-win32.zip"
Expand-Archive -Path "cs-x86_64-pc-win32.zip" -DestinationPath .
Rename-Item -Path "cs-x86_64-pc-win32.exe" -NewName "cs.exe"
Remove-Item -Path "cs-x86_64-pc-win32.zip"
.\cs setup

For every prompt, such as the ones asking if we would like to add whatever to his PATH, he typed Y.

At the end, running sbt worked, so we closed his Powershell and opened up CMD instead as that’s his preferred cli. sbt new scala/scala3.g8 resulted in “sbt is unrecognized command”. We assume “okay, it must only work on powershell”, so we re-opened Powershell and tried it there; same result. Even in Powershell, sbt is now unrecognized, as if the PATH for powershell had been totally reset and forgotten about the installation we had just successfully finished 1 minute ago.

After this failing for a third student on both Windows and Unix, I think I am going to strictly avoid Coursier and only use Chocolatey and SDKMAN/Homebrew for getting scala stuff on student’s computer for now. With students, the installation process needs to be a simple command paste requiring near zero configuration to avoid friction in a classroom setting. Not sure what’s going on, just providing feedback.

1 Like

It could be worthwhile to open an issue on Coursier Github

There are issues but the developers may not have any idea, especially on Windows, since developers rarely use Windows. Please report especially if it’s reproducible.

There are some plans to streamline the installation process, making it available on Chocolatey, SDKMAN, etc.

But I agree that currently cs is quite lacking / buggy and sticking to SDKMAN is probably best.

1 Like

I sometimes had an issue that I needed to restart the machine or at least relog for the changes in PATH to be noticed, I wonder if that is the case here. And if that is the case, I wonder how do the package managers make that work, maybe in their case the PATH is already changes?

2 Likes

I have had similar issues with my students on Windows. But a restart often helps. I’m curious to know if your issues are resolved with a restart after installing cs? @SJohn

Quote from the docs of coursier: Installation · Coursier :

If that does not work, you may need to log out and log back in (or reboot) in order for the changes to take effect.

wonder how do the package managers make that work

@tgodzik There seems to be some workarounds to this such as reported in various answers in this question thread: windows - How can I refresh my PATH variable from the registry, without a reboot, logoff, or restarting explorer? - Super User

1 Like

Thanks for letting me know! I raised an issue in order not to forget about that possible improvement. Automatically update Path variable on Windows · Issue #3050 · coursier/coursier · GitHub

I am trying to maintain coursier a bit, but currently I am unable to commit to larger improvement unless something super critical happens. I might have some time in the future, but I can’t promise anything.

2 Likes