dune icon indicating copy to clipboard operation
dune copied to clipboard

Can't install dune on Windows 10

Open privacyguy123 opened this issue 8 months ago β€’ 7 comments

Expected Behavior

Install Dune

Actual Behavior

Dune not installed

Reproduction

  1. opam install dune from Admin terminal
  2. error

Specifications

  • Version of dune (output of dune --version): can't install this
  • Version of ocaml (output of ocamlc --version): reports as not existing (I obviously have opam 2.3.0 installed)
  • Operating system (distribution and version): Windows 10

Additional information

opam install dune
The following actions will be performed:
=== install 1 package
  βˆ— dune 3.18.2

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
⬇ retrieved dune.3.18.2  (cached)

#=== ERROR while installing dune.3.18.2 =======================================#
Cannot copy C:\...\AppData\Local\opam\default\.opam-switch\build\dune.3.18.2\_build\install\default\bin\dune.exe to C:\...\AppData\Local\opam\default\bin\dune.exe (C:\Program Files\opam\bin\opam.exe: "open" failed on C:\...\AppData\Local\opam\default\bin\dune.exe: Permission denied).


<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
β”Œβ”€ The following actions failed
β”‚ βˆ— install dune 3.18.2
└─
╢─ No changes have been performed
# To update the current shell environment, run: (& opam env) -split '\r?\n' | ForEach-Object { Invoke-Expression $_ }

privacyguy123 avatar May 07 '25 18:05 privacyguy123

@nojb anything rings a bell?

rgrinberg avatar Aug 19 '25 16:08 rgrinberg

The problem here is that opam install dune is being done with the admin terminal. I would wager that if that was not done, this would work correctly. There are analogous issues with sudo and opam, but windows is a bit different since admin terminals still don't have all the permissions to modify files unless explicitly asked for.

Alizter avatar Aug 19 '25 17:08 Alizter

Are the three dots ... something that OPAM does to abbreviate long paths?

nojb avatar Aug 19 '25 19:08 nojb

Maybe @kit-ty-kate can confirm.

Alizter avatar Aug 20 '25 11:08 Alizter

Are the three dots ... something that OPAM does to abbreviate long paths?

no, i think it's the author's way to hide their HOME directory the same way someone on unix would replace it with ~/ if they don't want it to be public.

As for the issue, @privacyguy123 have you enabled Window's developer mode? opam init should have warned you that Windows won't let you use symlinks in some cases without it, and recommended to enable it. See https://learn.microsoft.com/en-gb/windows/apps/get-started/enable-your-device-for-development

kit-ty-kate avatar Aug 20 '25 11:08 kit-ty-kate

I have the same issue trying to install dune 3.20.2 on windows 10 from an non admin terminal (powershell). Trying to figure out the process tree of executable having a handle on that file...I see ocamllsp.exe, conhost.exe and dune.exe itself having a handle on that file. Not sure if that helps.

Heyji2 avatar Nov 30 '25 21:11 Heyji2

I killed the process dune.exe and relaunched the installation and voilΓ , it worked. So I assume during long installation process of several packages, when dune is launched several times, it may happen some time that the process do not terminate correctly and permissions to copy/move it are not granted.

Heyji2 avatar Dec 06 '25 15:12 Heyji2