haskell-platform icon indicating copy to clipboard operation
haskell-platform copied to clipboard

PATH in Windows corrupt after 2nd install of GHC

Open Ambusy opened this issue 9 years ago • 9 comments

Installed (absolute beginner!) Haskell default on windows X64: on the C:\ disk. Leads to problems with UAC rights when starting a tutorial with ghci. Disinstalled, and reinstalled on F:. In the path one reference to C:\Program Files\Haskell\bin remains, and ghci does not start.

Below the output of my PATH.

F:>path PATH=C:\Program Files\Haskell\bin;F:\Haskell\lib\extralibs\bin;F:\Haskell\bin;C: \Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86) \Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Microsoft SQL Server\110\Tools\Binn
;F:\Haskell\mingw\bin;C:\Users\ambusy\AppData\Roaming\cabal\bin

this issue was previously in https://ghc.haskell.org/trac/ghc/ticket/10916

Ambusy avatar Sep 27 '15 12:09 Ambusy

@randen -- looks like the uninstall script is just not fully comprehensive?

gbaz avatar Feb 16 '16 20:02 gbaz

The Haskell Platform does not create the "C:\Haskell\bin" but I if I recall correctly, this is from cabal-install. We do put it into the PATH variable, so packages/binaries which are globally installed by cabal will be found. We take "C:\Haskell\bin" out of the PATH variable upon uninstall, but we will not remove the directory (we didn't create it; we don't remove it). In Ambusy's scenario, the 2nd install re-added this directory to the PATH (it is hard-coded by cabal-install, as far as I know--this is where it must be), so installed HP to another location will not change where cabal-install expects its global packages to be.

It is possible the UAC issues Ambusy encountered may have been due to the tutorial suggesting to "cabal install" every package, and perhaps the "cabal install" line also specified "--global" which puts them into the global package database which could lead to UAC problems if not run from an Administrator account?

So, assuming the above, the actual problem that might need some kind of software/installer fix is that of not being able to find ghci.

@Ambusy, I apologize that my response is coming so late. Did you resolve this for yourself? Is the ghci.exe file actually in "F:\Haskell\bin"? If so, can you execute it from there (directly, that is, with the full path, "F:\Haskell\bin\ghci.exe")? Were you launching ghci from a "Command Prompt" (i.e., cmd) or perhaps from the GHCi short-cut in the Start menu for the Haskell Platform 7.10.2a (or maybe even the WinGHCi short-cut there)?

randen avatar Feb 17 '16 19:02 randen

I resolved the problem,manually changing the PATH in System. I reported it as many Windows users with the default install settings will run into the same problem, and I would avoid them the search I made to get the second install working.

Ambusy avatar Feb 17 '16 20:02 Ambusy

@randen -- the latest cabal-installs on windows appear to put binaries elsewhere?

In particular, after running a cabal install of a binary package I got its location as

/c/Users/<user name>/AppData/Roaming/cabal/bin/

So perhaps if we can verify this we no longer need add this directory to the path?

gbaz avatar Feb 17 '16 21:02 gbaz

@gbaz, with "--global"?

randen avatar Feb 18 '16 05:02 randen

hah, indeed the global option leads to the binary going into C:\Program Files\Haskell\bin.

So I guess the current behavior is correct.

gbaz avatar Feb 18 '16 21:02 gbaz

@Ambusy, I am glad you were able to resolve this. To do so, you mention you manually changed the PATH. Was your change to remove F:\Haskell\bin from the start of the PATH? Or, if not, can you recall what was it that you changed in your PATH? Also, I realize it was been awhile, but is there a possibility that you may have tried to launch "ghci.exe" from a Windows CMD window that had been opened after the first install but before the second (and thus did not get its PATH variable updated to reflect the second location)?

randen avatar Feb 21 '16 17:02 randen

I remember this: I installed the package without changing any default value. Next thing I did was to start the tutorial. I'm an beginner and like to be guided a bit to know the package. I got some messages from UAC, I don't remember exactly which, and it was clear that the tutorial was writing on the C:/program files, which was not allowed. I think that I granted ALL user rights to the map and retried, but of this I'm not sure. As I did not succeed to get the tutorial working I uninstalled it the package and immediately after reinstalled it on a usb-disk F: . Started the tutorial again and from the message I got (again I don't remember exactly which one) I deduced problems with the Path. I had the idea of a map missing, but when I started editing it, I saw the (removed) map on C: and removed that map from the path. afterwards the tutorial worked. Note: from tuesday I'll be unreachable for about one week.

Ambusy avatar Feb 21 '16 19:02 Ambusy

@Ambusy, thank you for taking the time to provide more details. I don't have any more questions just now but I will think more about what may have caused your troubles.

randen avatar Feb 24 '16 18:02 randen