Windows installation failed

Hi

I just tried installing OCaml on Windows 11 using the instructions from here

I used powershell in administrator mode.
The output I got was.

PS G:\download\programminglanguages\ocaml> .\setup-diskuv-ocaml-windows_x86_64-1.2.0.exe
dkml-package.bc: [e[34mINFOe[0m] Writing to registry for Add/Remove Programs
dkml-package.bc: [e[34mINFOe[0m] Running: C:\WINDOWS\system32\reg.exe import
                                   C:\Users\slayc\AppData\Local\Temp\uninstallf60055.reg
The operation completed successfully.
dkml-package.bc: [e[34mINFOe[0m] Detecting whether administrator privileges are needed by running
                        C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\sg\network-ocamlcompiler\windows_x86_64\setup-machine.bat
                          -DkmlPath
                          C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\sg\network-ocamlcompiler\windows_x86_64\dkmldir
                          -TempParentPath
                          C:\Users\slayc\AppData\Local\Temp\path_eval_3398a7
                          -SkipProgress -AllowRunAsAdmin
                          -SkipAutoInstallVsBuildTools
Start-Job : The pwsh executable cannot be found at "C:\Users\slayc\.dotnet\tools\.store\powershell\6.2.3\powershell\6.2.3\tools\netcoreapp2.1\any\win\pwsh.exe".
Note that 'Start-Job' is not supported by design in scenarios where PowerShell is being hosted in other applications. Instead, usage of the 'ThreadJob' module is recommended in such scenarios.
At line:1 char:1
+ -NoProfile -ExecutionPolicy Bypass -Command & {& 'C:\Users\slayc\AppD ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotInstalled: (C:\Users\slayc\.dot\u2026.1\any\win\pwsh.exe:String) [Start-Job], PSNotSupportedException
+ FullyQualifiedErrorId : IPCPwshExecutableNotFound,Microsoft.PowerShell.Commands.StartJobCommand

& 'C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\sg\network-ocamlcompiler\windows_x86_64\setup-machine.ps1' -DkmlPath C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\sg\network-ocamlcompiler\windows_x86_64\dkmldir -TempParentPath C:\Users\slayc\AppData\Local\Temp\path_eval_3398a7 -SkipProgress -AllowRunAsAdmin -SkipAutoInstallVsBuildTools; exit $LASTEXITCODE
dkml-package.bc: [INFO] Detected that a compatible Visual Studio was already installed; will not request administrator privileges
dkml-package.bc: [INFO] Running: C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\bin\dkml-install-user-runner.exe
                                   install-user-staging-opam64
                                   --verbosity=info --color=always --prefix
                                   C:\Users\slayc\AppData\Local\Programs\DiskuvOCaml
                                   --staging-files
                                   C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\sg
dkml-package.bc: [INFO] Running: C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\bin\dkml-install-user-runner.exe
                                   install-user-staging-ocamlrun
                                   --verbosity=info --color=always --prefix
                                   C:\Users\slayc\AppData\Local\Programs\DiskuvOCaml
                                   --staging-files
                                   C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\sg
dkml-package.bc: [INFO] Running: C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\bin\dkml-install-user-runner.exe
                                   install-user-staging-unixutils
                                   --verbosity=info --color=always --prefix
                                   C:\Users\slayc\AppData\Local\Programs\DiskuvOCaml
                                   --staging-files
                                   C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\sg
dkml-package.bc: [INFO] Running: C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\bin\dkml-install-user-runner.exe
                                   install-user-staging-desktop-compile
                                   --verbosity=info --color=always --prefix
                                   C:\Users\slayc\AppData\Local\Programs\DiskuvOCaml
                                   --staging-files
                                   C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\sg
dkml-package.bc: [INFO] Running: C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\bin\dkml-install-user-runner.exe
                                   install-user-staging-desktop-full
                                   --verbosity=info --color=always --prefix
                                   C:\Users\slayc\AppData\Local\Programs\DiskuvOCaml
                                   --staging-files
                                   C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\sg
dkml-package.bc: [INFO] Running: C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\bin\dkml-install-user-runner.exe
                                   install-user-staging-opam32
                                   --verbosity=info --color=always --prefix
                                   C:\Users\slayc\AppData\Local\Programs\DiskuvOCaml
                                   --staging-files
                                   C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\sg
dkml-package.bc: [INFO] Running: C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\bin\dkml-install-user-runner.exe
                                   install-user-staging-withdkml
                                   --verbosity=info --color=always --prefix
                                   C:\Users\slayc\AppData\Local\Programs\DiskuvOCaml
                                   --staging-files
                                   C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\sg
dkml-package.bc: [INFO] Running: C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\bin\dkml-install-user-runner.exe
                                   install-user-staging-dkmlconfdir
                                   --verbosity=info --color=always --prefix
                                   C:\Users\slayc\AppData\Local\Programs\DiskuvOCaml
                                   --staging-files
                                   C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\sg
dkml-package.bc: [INFO] Running: C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\bin\dkml-install-user-runner.exe
                                   install-user-offline-opamshim
                                   --verbosity=info --color=always --prefix
                                   C:\Users\slayc\AppData\Local\Programs\DiskuvOCaml
                                   --staging-files
                                   C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\sg
dkml-install-user-runner.exe: [INFO] Running bytecode with: C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\sg\staging-ocamlrun\windows_x86_64\bin\ocamlrun
                                                              C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\sg\offline-opamshim\generic\install_user.bc
                                                              --verbosity=info
                                                              --color=always
                                                              --opam-exe
                                                              C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\sg\staging-opam64\windows_x86_64\bin\opam.exe
                                                              --with-dkml-exe
                                                              C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\sg\staging-withdkml\windows_x86_64\bin\with-dkml.exe
                                                              --target-dir
                                                              C:\Users\slayc\AppData\Local\Programs\DiskuvOCaml
FATAL [ebe9e0f2]. rename C:\Users\slayc\AppData\Local\Programs\DiskuvOCaml\bin\bos-808e45.tmp to C:\Users\slayc\AppData\Local\Programs\DiskuvOCaml\bin\opam-real.exe: Permission denied

dkml-package.bc: [ERROR] FATAL [5f927a8b].
                         A transient failure occurred.

                         Root cause: The command had exit code 20:
                                       C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\bin\dkml-install-user-runner.exe
                                         install-user-offline-opamshim --verbosity=info --color=always
                                         --prefix C:\Users\slayc\AppData\Local\Programs\DiskuvOCaml
                                         --staging-files
                                         C:\Users\slayc\AppData\Local\Temp\7z9F5C695C\sg

                         >>> A transient failure occurred. <<<

I found two issues. Pwsh did not exist in the target directory but did exist earlier in the path. I copied the pwsh.exe to the target directory and the installation proceeded further before reaching the could not copy issue. On investigation the relevant directory already contained the file that the .tmp file was trying to be renames to. It seems I have an earlier installtion of ocaml but have no recollection of trying to do so. I deleted the relevant ocaml directories and .\setup-diskuv-ocaml-windows_x86_64-1.2.0.exe ran to completion without errors.

I closed the administrator mode powershell window and opened a new powershell.

Utop is not a recognised command. Do I need to add some paths to the %PATH% environment variable.?

Can you file an issue at https://github.com/diskuv/dkml-installer-ocaml/issues/new?

I’ll need you to dump into the issue as much stuff as possible from your system before we lose the forensic trail. Primarily about C:\Users\slayc\.dotnet\tools\.store\powershell\6.2.3\powershell\6.2.3\tools\netcoreapp2.1\any\win which you’ve had to hack (sounds dangerous, and this is definitely not auto-installed by DkML), and this other OCaml installation you mentioned.

The problem was a corrupt powershell installation

I can confirm that I now have a working Ocaml installation

I took the following steps

  1. Deleted all installations of powershell using the windows installer.
  2. Deleted the directory '‘C:\Users\slayc.dotnet\tools.store\powershell’ this removed powershell 6.2.3
  3. Deleted previous attempts at ocaml installation using windows installer
  4. Deleted any ocaml related directories at ''C:\Users\slayc\AppData\Local\Programs'
  5. Rebooted
  6. Installed powershell via windows store - powershell 7.3.6
  7. Rebooted
  8. Installed ocaml using .\setup-diskuv-ocaml-windows_x86_64-1.2.0.exe

The installation took much longer than previous install attempts and even fired up Visual Studio Installer to install 1.5gb worth of Visual Studia Tools 2019 amongst other things.

3 Likes