Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ghcup set fails on windows #1215

Open
ryani opened this issue Jan 15, 2025 · 10 comments · May be fixed by #1229
Open

ghcup set fails on windows #1215

ryani opened this issue Jan 15, 2025 · 10 comments · May be fixed by #1229
Assignees

Comments

@ryani
Copy link

ryani commented Jan 15, 2025

From ghcup tui, trying to set the ghc version fails:

[ Info  ] This Version of GHC you are trying to set is not installed.
[ ...   ] Would you like to install it first? [Y/N]:
y
[ Info  ] Setting now...
[ Info  ] This Version of GHC you are trying to set is not installed.
[ ...   ] Would you like to install it first? [Y/N]:
y
[ Info  ] Setting now...
[ Info  ] This Version of GHC you are trying to set is not installed.
[ ...   ] Would you like to install it first? [Y/N]:
n
Error: [GHCup-00130] The version 'ghcup' of the tool ghc is not installed.
Press enter to continue

Same GHCup-00130 error from the command line.

History: I had a previous installation of ghcup from a few years back that I tried to upgrade and it had this problem. I ran ghcup nuke, deleted c:\ghc, and reinstalled from the powershell script, and the same problem is still happening.

@ryani
Copy link
Author

ryani commented Jan 15, 2025

  • The version I am trying to set is installed.
  • In fact it's the only version installed, and it is currently the default ghc, although it's not listed as set in the ui
  • But in my old install I was trying to upgrade ghc versions and this prevented me from changing to the new version

@hasufell
Copy link
Member

Is all antivirus disabled?

Are you out of disk space?

@dfordivam
Copy link
Collaborator

Error: [GHCup-00130] The version 'ghcup' of the tool ghc is not installed.

This error is weird, did this happen when doing set from tui ?

This command causes the error, and this is a wrong command.

$ ghcup set ghc ghcup
[ Error ] [GHCup-00130] The version 'ghcup' of the tool ghc is not installed.

Correct one is this

$ ghcup set ghc 9.8.4
[ Info  ] GHC 9.8.4 successfully set as default version

@ryani
Copy link
Author

ryani commented Jan 16, 2025

Yes, I get that either from tui or when doing set from the command line:

>ghcup set ghc 9.4.8
[ Info  ] downloading: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-0.0.9.yaml as file C:\ghc\ghcup\cache\ghcup-0.0.9.yaml
[ Warn  ] New ghc version available. If you want to install this latest version, run 'ghcup install ghc 9.12.1'
[ Warn  ] New cabal version available. If you want to install this latest version, run 'ghcup install cabal 3.14.1.1'
[ Info  ] verifying digest of: gs.exe
[ Error ] [GHCup-00130] The version 'ghcup' of the tool ghc is not installed.

I agree that the error is strange.

@ryani
Copy link
Author

ryani commented Jan 16, 2025

Some more info:

ghcup list shows this (as part of its output):

X  ghc   9.4.7      base-4.17.2.0
I  ghc   9.4.8      recommended,base-4.17.2.1 hls-powered
X  ghc   9.6.1      base-4.18.0.0

(I expect this to say IS, that's correct, right?)

where ghc: C:\ghc\ghcup\bin\ghc.exe

ghc --version: The Glorious Glasgow Haskell Compilation System, version 9.4.8

I am pretty sure that if I install another version of ghc that I won't be able to switch to it -- that was the problem that had me reinstall.

@hasufell
Copy link
Member

We test that the optparse behaves correctly:

, ("set ghc 9.2", SetGHCVersion
$ GHCTargetVersion
Nothing
$(versionQ "9.2")
)

So I'm not sure how that would be possible. Did you add or change files? C:\ghc\ghcup is an unusual directory.

@ryani
Copy link
Author

ryani commented Jan 24, 2025

Did you add or change files?

I did not. Here is the timeline:

  • Installed ghcup a few years back to c:\ghc. No idea what version.
  • Updated ghcup to current and installed a new version of ghc a little over a week ago
  • ghcup set failed with the same error as above, and my set ghc version did not change
  • Ran ghcup nuke
  • After that completed, deleted my c:\ghc directory to remove any remaining stray files and rebooted
  • Created a new c:\ghc directory
  • Installed ghcup using the powershell installscript from https://www.haskell.org/ghcup/
  • Installed ghc (and other tools). It created the proper ghc.exe that points to the new version of ghc, but ghcup doesn't think that's set.
  • ghcup set still fails

This isn't blocking for me at the moment since I do have the version I wanted -- but I suspect I still can't update to a new compiler version.

Setting the versions of the other tools (HLS/Cabal) does work.

@hasufell
Copy link
Member

Make sure antivirus and windows defender are both disabled.

@dfordivam
Copy link
Collaborator

dfordivam commented Feb 7, 2025

I could reproduce this issue using "c:\ghc" as installation dir. The issue seems to be in the parsing logic to fetch the version from the link / shim path.
I am testing with installation/set of a different ghc, but its still at merging tree for almost two hour now..

@dfordivam dfordivam self-assigned this Feb 7, 2025
@hasufell
Copy link
Member

hasufell commented Feb 7, 2025

I am testing with installation/set of a different ghc, but its still at merging tree for almost two hour now..

Disable antivirus and windows defender.

dfordivam added a commit that referenced this issue Feb 9, 2025
The behavior of existing parser was to intrepret the version as "ghcup"
for the path "c:/ghc/ghcup/ghc/<ver>/bin/ghc"
Fixes #1215
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants