ERROR: IOError: rm("C:\\Users\\35879\\.julia\\artifacts\\jl_weK1vY\\bin"): directory not empty (ENOTEMPTY)

When I encountered this error while downloading the environment package, but the directory is empty.How should I handle it? I would be very grateful.

(ANN) pkg> add Flux, Images, Plots
   Resolving package versions...
     Failure artifact: Ghostscript
ERROR: IOError: rm("C:\\Users\\35879\\.julia\\artifacts\\jl_weK1vY\\bin"): directory not empty (ENOTEMPTY)
Stacktrace:
  [1] uv_error
    @ .\libuv.jl:106 [inlined]
  [2] rm(path::String; force::Bool, recursive::Bool)
    @ Base.Filesystem .\file.jl:307
  [3] rm(path::String; force::Bool, recursive::Bool)
    @ Base.Filesystem .\file.jl:294
  [4] rm
    @ .\file.jl:273 [inlined]
  [5] download_artifact(tree_hash::Base.SHA1, tarball_url::String, tarball_hash::Nothing; verbose::Bool, quiet_download::Bool, io::IOContext{IO}) 
    @ Pkg.Artifacts D:\vs code\Julia-1.11.1\share\julia\stdlib\v1.11\Pkg\src\Artifacts.jl:376
  [6] download_artifact (repeats 2 times)
    @ D:\vs code\Julia-1.11.1\share\julia\stdlib\v1.11\Pkg\src\Artifacts.jl:297 [inlined]
  [7] #22
    @ D:\vs code\Julia-1.11.1\share\julia\stdlib\v1.11\Pkg\src\Artifacts.jl:423 [inlined]
  [8] with_show_download_info(f::Pkg.Artifacts.var"#22#24"{Bool, Bool, IOContext{IO}, Base.SHA1, String}, io::IOContext{IO}, name::String, quiet_download::Bool)
    @ Pkg.Artifacts D:\vs code\Julia-1.11.1\share\julia\stdlib\v1.11\Pkg\src\Artifacts.jl:481
  [9] ensure_artifact_installed(name::String, meta::Dict{String, Any}, artifacts_toml::String; platform::Base.BinaryPlatforms.Platform, verbose::Bool, quiet_download::Bool, io::IOContext{IO})
    @ Pkg.Artifacts D:\vs code\Julia-1.11.1\share\julia\stdlib\v1.11\Pkg\src\Artifacts.jl:422
 [10] download_artifacts(env::Pkg.Types.EnvCache; platform::Base.BinaryPlatforms.Platform, julia_version::VersionNumber, verbose::Bool, io::IOContext{IO})
    @ Pkg.Operations D:\vs code\Julia-1.11.1\share\julia\stdlib\v1.11\Pkg\src\Operations.jl:771
 [11] add(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}, new_git::Set{Base.UUID}; allow_autoprecomp::Bool, preserve::Pkg.Types.PreserveLevel, platform::Base.BinaryPlatforms.Platform, target::Symbol)
    @ Pkg.Operations D:\vs code\Julia-1.11.1\share\julia\stdlib\v1.11\Pkg\src\Operations.jl:1435
 [12] add
    @ D:\vs code\Julia-1.11.1\share\julia\stdlib\v1.11\Pkg\src\Operations.jl:1400 [inlined]
 [13] add(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; preserve::Pkg.Types.PreserveLevel, platform::Base.BinaryPlatforms.Platform,
 target::Symbol, allow_autoprecomp::Bool, kwargs::@Kwargs{io::IOContext{IO}})
    @ Pkg.API D:\vs code\Julia-1.11.1\share\julia\stdlib\v1.11\Pkg\src\API.jl:306
 [14] add(pkgs::Vector{Pkg.Types.PackageSpec}; io::IOContext{IO}, kwargs::@Kwargs{})
    @ Pkg.API D:\vs code\Julia-1.11.1\share\julia\stdlib\v1.11\Pkg\src\API.jl:159
 [15] add(pkgs::Vector{Pkg.Types.PackageSpec})
    @ Pkg.API D:\vs code\Julia-1.11.1\share\julia\stdlib\v1.11\Pkg\src\API.jl:148
 [16] do_cmd(command::Pkg.REPLMode.Command, io::Base.TTY)
    @ Pkg.REPLMode D:\vs code\Julia-1.11.1\share\julia\stdlib\v1.11\Pkg\src\REPLMode\REPLMode.jl:407
 [17] do_cmds(commands::Vector{Pkg.REPLMode.Command}, io::Base.TTY)
    @ Pkg.REPLMode D:\vs code\Julia-1.11.1\share\julia\stdlib\v1.11\Pkg\src\REPLMode\REPLMode.jl:393
 [18] do_cmds(repl::REPL.LineEditREPL, commands::String)
    @ REPLExt D:\vs code\Julia-1.11.1\share\julia\stdlib\v1.11\Pkg\ext\REPLExt\REPLExt.jl:92
 [19] on_done(s::REPL.LineEdit.MIState, buf::IOBuffer, ok::Bool, repl::REPL.LineEditREPL)
    @ REPLExt D:\vs code\Julia-1.11.1\share\julia\stdlib\v1.11\Pkg\ext\REPLExt\REPLExt.jl:106
 [20] #invokelatest#2
    @ .\essentials.jl:1055 [inlined]
 [21] invokelatest
    @ .\essentials.jl:1052 [inlined]
 [22] (::REPLExt.var"#47#50"{REPL.LineEditREPL})(s::REPL.LineEdit.MIState, buf::IOBuffer, ok::Bool)
    @ REPLExt D:\vs code\Julia-1.11.1\share\julia\stdlib\v1.11\Pkg\ext\REPLExt\REPLExt.jl:128
 [23] #invokelatest#2
    @ .\essentials.jl:1055 [inlined]
 [24] invokelatest
    @ .\essentials.jl:1052 [inlined]
 [25] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit D:\vs code\Julia-1.11.1\share\julia\stdlib\v1.11\REPL\src\LineEdit.jl:2755
 [26] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL D:\vs code\Julia-1.11.1\share\julia\stdlib\v1.11\REPL\src\REPL.jl:1471
 [27] (::REPL.var"#75#81"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL D:\vs code\Julia-1.11.1\share\julia\stdlib\v1.11\REPL\src\REPL.jl:480

Is julia nightly able to download Ghostscript? If you have juliaup you can use juliaup add nightly, otherwise you can download julia nightly from Julia Downloads (nightly binaries)

ok,thank you!

Great. Once you install an artifact with julia nightly you can go back to using julia 1.11, and it should not need to install the same artifact again.

I regularly get this error on our Windows CI and locally. Retrying usually works. If I’m not mistaken it has to do with antivirus temporarily locking the file.
See Artifact folder could not be made on Windows. · Issue #3822 · JuliaLang/Pkg.jl · GitHub.

The error message was improved in Better error messages if artifact rename fails by nhz2 · Pull Request #3827 · JuliaLang/Pkg.jl · GitHub.

And an automatic retry was added in Retry artifact rename if it fails by nhz2 · Pull Request #4001 · JuliaLang/Pkg.jl · GitHub.
This was backported on the release-1.11 branch according to the checkmark in [release-1.11] 1.11 backports by IanButterworth · Pull Request #4037 · JuliaLang/Pkg.jl · GitHub. @ianshmean I don’t see the commit in the PR, nor in Comparing master...release-1.11 · JuliaLang/Pkg.jl · GitHub. Not sure if I’m not looking well or that this fell between the cracks.

Huh. Odd. Can you try opening a PR to backport it.

1 Like

Done in Backport artifact rename to 1.11 by visr · Pull Request #4099 · JuliaLang/Pkg.jl.

1 Like